Created
May 12, 2014 21:27
-
-
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?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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