JSFiddle - React, Tailwind, and code Playground
JavaScript
// up 2 directories modules ../ configs ../ root
var projectRoot = '../../',
helper = require(projectRoot + 'grunthelpers'),
configure = require(projectRoot + 'config/config_hack');
// Module build configuration file.
module.exports = function(grunt) {
grunt.initConfig({
clean: {
options: {
force: true
},
clean: ["/tmp/backbone/login", "css/modules/login"]
},
compassWithConfig: {
// options normally passed into compass.dist.options
options: {
specify: ['client-source/scss/modules/login/*.scss']
}
},
watch: { // for development run 'grunt watch'
compass: {
files: [
'client-source/scss/modules/login/*.scss',
'client-source/scss/partials/login-desktop/*.scss',
'client-source/scss/partials/login-mobile/*.scss'
],
tasks: ['compassWithConfig']
}
}
});
// TODO: make this grunt task a plugin while injecting configure/zookeeper as a dependency
grunt.registerTask('compassWithConfig', 'Run compass with external async config loaded first', function () {
// let grunt know this is async to wait for the zookeeper call
var done = this.async();
var options = this.options();
// run zookeeper with callback, CONFIG injected at global scope
configure(function() {
var compassOptions = helper.compassOptions(options, CONFIG);
// set the value to for compass
grunt.config.set('compass.dist.options', compassOptions);
// call compass
grunt.task.run('compass');
done();
});
});
grunt.file.setBase(projectRoot);
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compass');
...