2013-11-27 61 views
1

我想能够在我自己的应用程序中复制ng-boilerplate的脚本编译过程,但我无法使其工作。ng-boilerplate grunt脚本编译

我指的是具有index.html的这条线被编译到我的应用程序的所有脚本列表:

<!-- compiled JavaScript --><% scripts.forEach(function (file) { %> 
<script type="text/javascript" src="<%= file %>"></script><% }); %> 

我加入了filterForJS功能,并在我的gruntfile.js注册的多任务,但它不工作:(

回答

2

有添加的选项的指标任务?

```

/** 
* The `index` task compiles the `index.html` file as a Grunt template. CSS 
* and JS files co-exist here but they get split apart later. 
*/ 
index: { 

    /** 
    * During development, we don't want to have wait for compilation, 
    * concatenation, minification, etc. So to avoid these steps, we simply 
    * add all script files directly to the `<head>` of `index.html`. The 
    * `src` property contains the list of included files. 
    */ 
    build: { 
    dir: '<%= build_dir %>', 
    src: [ 
     '<%= vendor_files.js %>', 
     '<%= build_dir %>/src/**/*.js', 
     '<%= html2js.common.dest %>', 
     '<%= html2js.app.dest %>', 
     '<%= vendor_files.css %>', 
     '<%= recess.build.dest %>' 
    ] 
    }, 

    /** 
    * When it is time to have a completely compiled application, we can 
    * alter the above to include only a single JavaScript and a single CSS 
    * file. Now we're back! 
    */ 
    compile: { 
    dir: '<%= compile_dir %>', 
    src: [ 
     '<%= concat.compile_js.dest %>', 
     '<%= vendor_files.css %>', 
     '<%= recess.compile.dest %>' 
    ] 
    } 
}, 

```