mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Start abstracting away Gruntfile duplication
This commit is contained in:
+26
-24
@@ -179,30 +179,6 @@ module.exports = (grunt) ->
|
||||
}
|
||||
}
|
||||
|
||||
jade: {
|
||||
main: {
|
||||
expand: true
|
||||
cwd: 'source'
|
||||
src: [ '*.jade', 'partials/**/*.jade' ]
|
||||
dest: 'build'
|
||||
ext: '.html'
|
||||
options: {
|
||||
data: _.extend {}, vars, template_data
|
||||
pretty: true
|
||||
}
|
||||
}
|
||||
min: {
|
||||
expand: true
|
||||
cwd: 'source'
|
||||
src: [ '*.jade', 'partials/**/*.jade' ]
|
||||
dest: 'build-min'
|
||||
ext: '.html'
|
||||
options: {
|
||||
data: _.extend {}, vars, template_data, { min: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qunit: {
|
||||
main: {
|
||||
options: {
|
||||
@@ -234,6 +210,32 @@ module.exports = (grunt) ->
|
||||
}
|
||||
}
|
||||
|
||||
add = (defaults, subtasks) ->
|
||||
subtasks.map((item) -> [
|
||||
item[0]
|
||||
_.extend {
|
||||
expand: true
|
||||
cwd: 'source'
|
||||
dest: if /^min/.test(item[0]) then 'build-min' else 'build'
|
||||
}, defaults, item[1]
|
||||
]).reduce((params, param) ->
|
||||
params[param[0]] = param[1]
|
||||
params
|
||||
, {})
|
||||
|
||||
grunt.config 'jade', add({
|
||||
src: [ '*.jade', 'partials/**/*.jade' ]
|
||||
ext: '.html'
|
||||
}, [
|
||||
[ 'main', { options: {
|
||||
data: _.extend {}, vars, template_data
|
||||
pretty: true
|
||||
}}]
|
||||
[ 'min', { options: {
|
||||
data: _.extend {}, vars, template_data, { min: true }
|
||||
}}]
|
||||
])
|
||||
|
||||
# Load tasks
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
|
||||
Reference in New Issue
Block a user