0

因此,我已經開始對一個新項目的角度,這是偉大的,唯一的問題是,我喜歡構造我的意見和部分等,例如一個偉大的結構是我類似如下:使用喲角度發生器在視圖下有子目錄

app/views/_partials/modals 
app/views/_partials/menus 
app/views/_partials/buttons 
app/views/index.html 
app/views/about.html 

然而,似乎建設成dist文件夾時的角度發電機看起來不是子目錄和我得到的各種缺失包括和錯誤的。

我可以更改Grunt以查看這些子目錄並相應地處理視圖,以便它們在構建後出現在我的應用程序中?

我設了一個有趣的塊,我認爲可能是負責我的咕嚕聲文件:

ngtemplates: { 
    dist: { 
    options: { 
     module: 'myApp', 
     htmlmin: '<%= htmlmin.dist.options %>', 
     usemin: 'scripts/scripts.js' 
    }, 
    cwd: '<%= yeoman.app %>', 
    src: 'views/{,*/}*.html', 
    dest: '.tmp/templateCache.js' 
    } 
}, 

或者是一些在usemin塊?我很困惑(比較新的角度):

usemin: { 
    html: ['<%= yeoman.dist %>/{,*/}*.html'], 
    css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], 
    js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'], 
    options: { 
    assetsDirs: [ 
     '<%= yeoman.dist %>', 
     '<%= yeoman.dist %>/images', 
     '<%= yeoman.dist %>/styles' 
    ], 
    patterns: { 
     js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']] 
    } 
    } 
}, 

回答

2

好了,我想通了這一個了,這個問題是在ngtemplates塊,現在我的代碼如下所示:

ngtemplates: { 
    dist: { 
    options: { 
     module: 'myApp', 
     htmlmin: '<%= htmlmin.dist.options %>', 
     usemin: 'scripts/scripts.js' 
    }, 
    cwd: '<%= yeoman.app %>', 
    src: 'views/**/**/*.html', 
    dest: '.tmp/templateCache.js' 
    } 
}, 

公告src屬性已經改變了從:

src: 'views/{,*/}*.html', 

到:

src: 'views/**/**/*.html', 

這似乎捕獲_partials目錄中的所有模板