Last active
December 20, 2015 05:09
-
-
Save dbankier/6076275 to your computer and use it in GitHub Desktop.
Gruntfile for Alloy projects using jade and ltss This work in progress and likely to expand to include alloy commands, tishadow, xml2tss, etc, etc
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
jade: { | |
compile: { | |
options: { | |
pretty: true | |
}, | |
files: [{ | |
expand: true, | |
src: ['**/*.jade'], | |
dest: 'app', | |
cwd: 'app', | |
ext: '.xml' | |
}] | |
} | |
}, | |
ltss: { | |
compile: { | |
files: [{ | |
expand: true, | |
src: ['**/*.ltss'], | |
dest: 'app', | |
cwd: 'app', | |
ext: '.tss' | |
}] | |
} | |
}, | |
watch: { | |
options: { | |
nospawn: true | |
}, | |
jade: { | |
files:'app/**/*.jade', | |
tasks: ['jade'] | |
}, | |
ltss: { | |
files: 'app/**/*.ltss', | |
tasks: ['ltss'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-jade'); | |
grunt.loadNpmTasks('grunt-ltss'); | |
grunt.registerTask('default', ['jade','ltss']); | |
//only modify changed file | |
grunt.event.on('watch', function(action, filepath) { | |
var o = {}; | |
if (filepath.match(/.jade$/)) { | |
o[filepath.replace(".jade",".xml")] = [filepath]; | |
grunt.config.set(['jade', 'compile', 'files'],o); | |
} else if (filepath.match(/.ltss$/)){ | |
o[filepath.replace(".ltss",".tss")] = [filepath]; | |
grunt.config.set(['ltss', 'compile', 'files'],o); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like I need to learn Grunt....
.. or wait for you to write a decent blog about how to use this ;0