Skip to content

Instantly share code, notes, and snippets.

@dbankier
Last active December 20, 2015 05:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbankier/6076275 to your computer and use it in GitHub Desktop.
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
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);
}
});
};
@dbankier
Copy link
Author

Here are the dev dependancies:

"devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-jade": "~0.7.0",
    "grunt-contrib-watch": "~0.5.1",
    "grunt-ltss": "~0.1.0"
  }

@FokkeZB
Copy link

FokkeZB commented Jul 25, 2013

Looks like I need to learn Grunt....

.. or wait for you to write a decent blog about how to use this ;0

@dbankier
Copy link
Author

@FokkeZB, will probably mention it at tiConf AU if I don't blog about it sooner.

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