【问题标题】:grunt-contrib-concat - How to include concatenated path in separator?grunt-contrib-concat - 如何在分隔符中包含连接路径?
【发布时间】:2013-04-14 04:20:45
【问题描述】:

鉴于这个简单的设置:

concat: {
        options: {
            stripBanners: false,
            separator: '\n/* path to js file */\n'
        },
        dist: {
            src: ['js/*.js'],
            dest: 'dist/<%= pkg.name %>-concat.js'
        }
    }

有没有办法在每个分隔符中动态包含连接路径?

理想的串联文件应该是:

/* js/file1.js */
var someFunction = function(){

}

/* js/file2.js */
var anotherFunction = function(){
}

我是 Grunt 的新手,欢迎提出任何想法。

谢谢,

Seb.

【问题讨论】:

    标签: javascript gruntjs


    【解决方案1】:

    在进程选项中你可以把这种方式放

    process: function(src, filepath) {
            console.log('// Source: ' + filepath + '\n'); ;
            return '// Source: ' + filepath + '\n'+src;
          }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-10
      • 1970-01-01
      • 2013-03-22
      • 2016-09-13
      • 1970-01-01
      • 2012-11-16
      • 2015-01-19
      相关资源
      最近更新 更多