【问题标题】:grunt-ng-annotate all angularjs filesgrunt-ng-注释所有 angularjs 文件
【发布时间】:2015-10-02 17:02:05
【问题描述】:

我想通过 grunt 对我项目的所有 angular 文件运行 ng-annotate。
找不到这个选项。

我只有通过指定文件名进行注释的选项。

ngAnnotate: {
        dist: {
            files: {
                'output_file_name.js': ['input_file_name'],
            },
        }
    }

我需要更通用的东西,可以在特定目录上递归运行。

【问题讨论】:

    标签: angularjs grunt-contrib-uglify ng-annotate


    【解决方案1】:

    您可以使用其他配置浏览文件夹并注释每个文件,这些文件将在*.annotated.js 文件中输出。

    ngAnnotate: {
        dist: {
            files: [{
                    expand: true,
                    src: ['**/*.js', '!**/*.annotated.js'],
                    ext: '.annotated.js',
                    extDot: 'last'
                }],
        }
    }
    

    【讨论】:

    • 谢谢@Mike,但它不是会将所有 *.js 文件合并到 output_file_name.js 中吗?
    • 确实,我已经更新了我的答案,它将分别注释每个文件并编写一个.annotated.js 版本
    • 谢谢@Mike,我只想强调有两点需要注意:1. "files" 的数组形式,2. src: ['*/.js'] 多个文件的表单
    猜你喜欢
    • 2015-05-09
    • 2016-03-05
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 2014-08-10
    • 2018-11-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多