2

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

FXG
  • 1,308
  • 1
  • 12
  • 21

2 Answers2

3

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

Community
  • 1
  • 1
romuleald
  • 1,406
  • 16
  • 31
  • intro and outro. Thanks for that, I think it's the cleanest way to do what I'm looking for. – FXG Apr 09 '15 at 16:55
1

I think you might want to have a look at Browserify and Browserify-shim. It's an excellent way of scoping your dependencies without polluting the global namespace. It's works well with grunt and gulp and supports sourcemaps too.

deowk
  • 4,280
  • 1
  • 25
  • 34