Last active
August 29, 2015 14:01
-
-
Save Grawl/003c9b30e4e879ca540a to your computer and use it in GitHub Desktop.
grunt file with path variables
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just solved dependency management problem with
newer
override declaration.