Skip to content

Instantly share code, notes, and snippets.

@joshdcomp
Created May 12, 2014 21:27
Show Gist options
  • Save joshdcomp/bd0bc765b94b022c3a58 to your computer and use it in GitHub Desktop.
Save joshdcomp/bd0bc765b94b022c3a58 to your computer and use it in GitHub Desktop.
Quick gist for injecting a filepath/separator into your concatted script files. You're concatting your scripts right?
grunt.initConfig({
concat: {
options: {
//Get the filepath, format it, put in whatever separator you want, and echo the script itself
// src = the actual code of whatever your file is
// filepath = Sandstorm, Darude
process: function(src, filepath){
var lines = '\n//--------------------------------------------------\n'
var final_name = filepath.substring(filepath.lastIndexOf('/js/') + 1, filepath.length);//.join('-');
return( lines
+ '// Source: '
+ final_name
+ lines
+ src);
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment