-
-
Save evocateur/5579924 to your computer and use it in GitHub Desktop.
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
grunt.initConfig({ | |
// Runs the YUI3 build tool on a directory. Docs: <http://yui.github.io/shifter/> | |
"shifter": { | |
"crm-src": { | |
// (optional) version - What to fill in on the "@VERSION@" field in built files | |
"version": "CRM", | |
// (optional) lint can be 'config' or false | |
// if "config", shifter will use the nearest .jshintrc JSON file as JSHint config | |
// if "false", shifter will skip the lint step entirely. | |
"lint" : "config", | |
// src is the root directory to run shifter --walk. | |
"src" : "apps/ui/web-app/js/crm-src", | |
// (optional) dest is the build directory. If missing, it places in {src}/../build/ | |
"dest" : "apps/ui/web-app/js/crm-build" | |
} | |
} | |
}); |
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
/*jslint node:true */ | |
module.exports = function (grunt) { | |
var exec = require('child_process').spawn, | |
path = require('path'); | |
grunt.registerMultiTask('shifter', 'Run shifter', function () { | |
var done = this.async(), | |
args = [], | |
shifter; | |
args.push('--walk'); | |
if (this.data.dest) { | |
args.push('--build-dir'); | |
args.push(path.relative(this.data.src, this.data.dest)); | |
} | |
if (this.data.lint === false) { | |
args.push('--no-lint'); | |
} | |
if(this.data.lint === 'config') { | |
args.push('--lint', 'config'); | |
} | |
if(this.data.version) { | |
args.push('--replace-version=' + this.data.version); | |
} | |
if (grunt.option('verbose')) { | |
args.push('--lint-stderr'); // print lint errors | |
} | |
shifter = exec('shifter', args, { | |
cwd: this.data.src, | |
stdio: 'inherit', | |
env: process.env | |
}); | |
shifter.on('exit', function (code) { | |
if (code) { | |
grunt.fail.fatal('Shifter failed with code: ' + code); | |
} else { | |
grunt.log.ok('Shifter build complete.'); | |
done(); | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment