Skip to content

Instantly share code, notes, and snippets.

@jakeboxer
Last active December 17, 2015 13:19
Show Gist options
  • Select an option

  • Save jakeboxer/5616042 to your computer and use it in GitHub Desktop.

Select an option

Save jakeboxer/5616042 to your computer and use it in GitHub Desktop.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
widgetPath: 'public/static/components',
relativeCoffeePath: '**/javascripts/**',
coffee: {
compile: {
files: [
{
expand: true,
cwd: '<%= widgetPath %>',
src: '<%= relativeCoffeePath %>/*.js.coffee',
dest: '<%= widgetPath %>',
ext: '.js',
rename: function(dest, src){
return dest + src
}
}
]
},
concat: {
dist: {
files: [
{
expand: true,
cwd: '<%= widgetPath %>',
src: '<%= relativeCoffeePath %>/*.js',
dest: '<%= widgetPath %>',
ext: '.js',
rename: function(dest, src){
// Split the src into an array of path components
srcComponents = src.split("/")
// Cut out the second to last one
srcComponents.splice(srcComponents.length - 2, 1)
// Join the path components back together into a path
newSrc = "/" + srcComponents.join("/")
return dest + newSrc
}
}
]
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment