NG-样板咕噜脚本编译 [英] ng-boilerplate grunt scripts compilation

查看:192
本文介绍了NG-样板咕噜脚本编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够复制NG-样板的脚本编译过程中我自己的应用程序,但我无法得到它的工作。

I would like to be able to duplicate ng-boilerplate's script compilation process in my own app, but I am unable to get it working.

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

I am referring to having this line in index.html be compiled into a list of all the scripts in my app:

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

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

I added the filterForJS function and registered the multi task in my gruntfile.js, but it is not working :(

推荐答案

让您添加的选项为指标任务?

Have you added the options for the index task?

```

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

```

这篇关于NG-样板咕噜脚本编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆