Skip to content

Instantly share code, notes, and snippets.

@Grawl
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grawl/003c9b30e4e879ca540a to your computer and use it in GitHub Desktop.
Save Grawl/003c9b30e4e879ca540a to your computer and use it in GitHub Desktop.
grunt file with path variables
direction=
source:'./source/'
public:'./public/'
path=
source:
dir:direction.source
styles:
dir:direction.source+'styles/'
files:'*.sass'
templates:
dir:direction.source+'templates/'
files:'*.jade'
data:'*.json'
public:
dir:direction.public
pages:'*.html'
library:
dir:direction.public+'library/'
styles:'*.css'
any:'**/'
module.exports=(grunt) ->
grunt.initConfig
pkg:grunt.file.readJSON 'package.json'
sass:
compile:
options:
sourcemap:true
require:'rails-sass-images'
style:'compressed'
noCache:true
files:[
expand:true
cwd:path.source.styles.dir
src:path.source.styles.files
dest:path.public.library.dir
ext:'.css'
]
autoprefixer:
compile:
options:
map:true
files:[
expand:true
flatten:true
src:path.public.library.styles
dest:path.public.library.dir
]
jade:
compile:
options:
pretty:true
data:(dest,src) ->
return require('./source/index.json')
files:[
expand:true
cwd:path.source.templates.dir
src:path.source.templates.files
dest:path.public.dir
ext:'.html'
]
newer:
options:
override: (detail, include) ->
if detail.task is 'jade'
include true
else
include false
watch:
livereload:
files: [
path.public.library.dir+path.public.library.styles
path.public.dir+path.public.pages
]
options:
livereload: true
css:
files:path.source.styles.dir+path.any+path.source.styles.files
tasks:[
'sass'
'autoprefixer'
]
html:
files:[
path.source.templates.dir+path.any+path.source.templates.files
path.source.templates.dir+path.any+path.source.templates.data
]
tasks:[
'newer:jade'
]
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.registerTask 'templates',['jade']
grunt.registerTask 'styles',['sass']
grunt.registerTask 'templates:newer',['newer:jade']
grunt.registerTask 'styles:newer',['newer:sass']
grunt.registerTask 'default',['watch']
return
@Grawl
Copy link
Author

Grawl commented Jun 5, 2014

just solved dependency management problem with newer override declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment