簡體   English   中英

ng-boilerplate grunt腳本編譯

[英]ng-boilerplate grunt scripts compilation

我希望能夠在自己的應用程序中復制ng-boilerplate的腳本編譯過程,但無法使其正常運行。

我指的是將index.html中的這一行編譯成我的應用程序中所有腳本的列表:

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

我添加了filterForJS函數並在我的gruntfile.js中注冊了多任務,但是它不起作用:(

您是否添加了索引任務的選項?

```

/**
 * 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 %>'
    ]
  }
},

```

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM