Skip to content

Instantly share code, notes, and snippets.

@naganowl
Created August 5, 2014 21:50
Show Gist options
  • Save naganowl/a3f282aa1bae7519d4fd to your computer and use it in GitHub Desktop.
Save naganowl/a3f282aa1bae7519d4fd to your computer and use it in GitHub Desktop.
Move files into a new location, discarding it's previous file hierarchy
module.exports = (grunt) ->
# Requires a `renameBase` property in task config options.
flattenPath = (dest, src) ->
path = grunt.task.current.data.renameBase
# Make files sibling to those in `renameBase`.
if src.indexOf(path) is 0
dest + src.slice path.length
else
dest + src
grunt.initConfig
copy:
assets:
files: [
# Fonts, images, etc.
expand: yes
src: 'app/assets/**'
dest: 'public/'
renameBase: 'app/assets'
rename: flattenPath
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment