简体   繁体   English

grunt-contrib-concat-如何在分隔符中包含串联路径?

[英]grunt-contrib-concat - How to include concatenated path in separator?

Given this simple setup: 鉴于此简单的设置:

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

Is there any way to dynamically include the concatenated path in each separator? 有什么方法可以在每个分隔符中动态包含级联路径?

The ideal concatenated file should be: 理想的串联文件应为:

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

}

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

I'm new to Grunt, any ideas appreciated. 我是Grunt的新手,任何想法都值得赞赏。

Thanks, 谢谢,

Seb. 勒布。

in the process options you can put of this manner 在过程选项中,您可以采用这种方式

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM