【问题标题】:Destination folder with ngAnnotate带有 ngAnnotate 的目标文件夹
【发布时间】:2017-03-22 12:58:20
【问题描述】:

我的项目文件夹如下所示:

project
__src
____main
______webapp
________WEB-INF
__________app
____________components
            //Angular files here.

我有一个使用 ng-annotate 配置的繁重任务:

 ngAnnotate: {
      options: {
          singleQuotes: true
      },
      app: {
          files: [{
                expand: true,
                src: 'src/main/webapp/WEB-INF/app/components/**/*.js',
                ext: '.safe.js',
                dest: 'src/main/webapp/WEB-INF/app/min',
                extDot: 'last'
          }]
      }
  },

我想要文件夹“src/main/webapp/WEB-INF/app/min”中的所有带注释的文件,全部放在一起。

我的问题是 grunt 任务将整个路由创建到我介意的“min”文件夹中的文件:

我在 src/main/webapp/WEB-INF/app/components/module/module.js 中有一个文件 我想要 src/main/webapp/WEB-INF/app/min/module.safe.js 中的那个文件

但是我得到了 src/main/webapp/WEB-INF/app/min/src/main/webapp/WEB-INF/app/components/module/module.safe.js

如何在不创建整个路径的情况下完成这项任务??

【问题讨论】:

    标签: angularjs gruntjs ng-annotate


    【解决方案1】:

    我终于用cwd命令解决了,所以。

    ngAnnotate: {
          options: {
              singleQuotes: true
          },
          app: {
              files: [{
                    expand: true,
                    cwd: 'src/main/webapp/WEB-INF/app/components/',
                    src: ['**/*.js', '**/*.js', '!**/min/*', '!**/min-app/*'],
                    ext: '.safe.js',
                    dest: 'src/main/webapp/WEB-INF/app/min',
                    extDot: 'last'
              }]
          }
      },
    

    cwd 是到源路径的路由。 Src 只会使用 javascript 名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-02
      • 1970-01-01
      • 1970-01-01
      • 2011-12-27
      • 2021-12-08
      • 1970-01-01
      • 2019-10-13
      相关资源
      最近更新 更多