【问题标题】:Is there any way to copy all the scripts from the bower components to dist/script folder in grunt without minification?有没有办法将所有脚本从凉亭组件复制到 grunt 中的 dist/script 文件夹而不缩小?
【发布时间】:2016-01-25 06:00:57
【问题描述】:

我已经用yeomean 生成了 Angular 项目。

我有一种情况,我需要在构建之后显示我的 angular 项目中使用的所有脚本,但是在使用 grunt build 命令之后,grunt 会缩小所有脚本文件。

当我运行grunt build 命令时,有什么方法可以将所有脚本文件从bower_components/some_module/some_script.js 复制到dist/scripts/some_scripts.js?

有一种方法可以使用 grunt 的copy 任务,如下所示:

copy: {
  main: {
    src: 'bower_coponents/some_module/some_script.js',
    dest: 'dist/scripts/some_script.js',
  },
}

但不知道如何从app/index.html 获取所有脚本文件。

【问题讨论】:

  • 如果复制有效,为什么不在构建任务中运行复制任务呢? (另外,可能想研究干净的凉亭安装程序,用于将资产从凉亭复制到库文件夹中。)
  • stackoverflow.com/questions/18966485/… 这可能对你有帮助

标签: javascript angularjs node.js gruntjs bower


【解决方案1】:

这段代码可以工作,因为它在我的项目中工作

 copy: {
          main: {
            files: [
              {expand: true, cwd: 'bower_coponents/some_module', src: ['**.js'], dest: 'dist/scripts/'},
           ],
          },
        },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-08
    • 1970-01-01
    • 1970-01-01
    • 2018-07-20
    • 1970-01-01
    • 1970-01-01
    • 2014-02-15
    • 2019-07-23
    相关资源
    最近更新 更多