2

鉴于这个简单的设置:

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 的新手,任何想法都表示赞赏。

谢谢,

赛博。

4

1 回答 1

1

在流程选项中,您可以采用这种方式

process: function(src, filepath) {
        console.log('// Source: ' + filepath + '\n'); ;
        return '// Source: ' + filepath + '\n'+src;
      }
于 2018-05-10T19:31:37.907 回答