Search code examples
javascriptgruntjsgrunt-contrib-concat

How to grunt concat in a wrapping function


I have three files containing js classes:

A.js
B.js
C.js

I'm trying to concatenate them to get something like:

var Module = (function (scope) {
// content of concatenation (ABC.js)
})(scope);

For now I'm using https://www.npmjs.com/package/grunt-contrib-concat to concatenate, I saw https://www.npmjs.com/package/grunt-wrap, it seems to be abandonned but look like what I want.

Someone has an idea to achieve it without using grunt-concat?

PS: I want to keep a *.map file for debug purpose


Solution

  • Are you looking for the banner/footer of https://github.com/gruntjs/grunt-contrib-concat?

    Or this kind of concatenation with 2 files for intro and outro? I'm trying out Grunt and need a simple way to concatenate my modules