Skip to content

Instantly share code, notes, and snippets.

@BrianGenisio
Created September 9, 2014 16:02
Show Gist options
  • Save BrianGenisio/7292a2e0eeed25edf0ac to your computer and use it in GitHub Desktop.
Save BrianGenisio/7292a2e0eeed25edf0ac to your computer and use it in GitHub Desktop.
Automatically wrapping files in IIFEs
grunt.initConfig({
concat: {
dist: {
src: ['src/*.js'],
dest: 'dist/app.js',
options: {
process: wrapInIIFE
}
},
},
});
function wrapInIIFE(src, filepath) {
var header = '(function() { \n';
var footer = '\n})();\n';
return header + src + footer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment