简体   繁体   中英

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.

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;
      }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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