mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-03 03:04:27 +02:00
massive grunt update
This commit is contained in:
parent
b3f87d7af3
commit
05fdff72f5
1 changed files with 12 additions and 7 deletions
19
grunt.js
19
grunt.js
|
@ -28,13 +28,17 @@ module.exports = function(grunt) {
|
||||||
grunt.registerTask('buildIndex', 'stick in hashed resources', function() {
|
grunt.registerTask('buildIndex', 'stick in hashed resources', function() {
|
||||||
grunt.log.writeln('Building index...');
|
grunt.log.writeln('Building index...');
|
||||||
|
|
||||||
// first find the one in here that has the hash
|
// first find the one in here that we want
|
||||||
var hashRegex = /bundle\.min\.\w+\.js/;
|
|
||||||
var buildFiles = fs.readdirSync('build');
|
var buildFiles = fs.readdirSync('build');
|
||||||
|
|
||||||
var hashedMinFile;
|
var hashedMinFile;
|
||||||
|
if (buildFiles.length == 2) {
|
||||||
|
grunt.log.writeln('Assuming debug mode wanted');
|
||||||
|
hashedMinFile = 'bundle.js';
|
||||||
|
}
|
||||||
|
var jsRegex = /bundle\.min\.\w+\.js/;
|
||||||
_.each(buildFiles, function(jsFile) {
|
_.each(buildFiles, function(jsFile) {
|
||||||
if (hashRegex.test(jsFile)) {
|
if (jsRegex.test(jsFile)) {
|
||||||
if (hashedMinFile) {
|
if (hashedMinFile) {
|
||||||
throw new Error('more than one hashed file: ' + jsFile + hashedMinFile);
|
throw new Error('more than one hashed file: ' + jsFile + hashedMinFile);
|
||||||
}
|
}
|
||||||
|
@ -158,6 +162,7 @@ module.exports = function(grunt) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// all my npm helpers
|
||||||
grunt.loadNpmTasks('grunt-jslint');
|
grunt.loadNpmTasks('grunt-jslint');
|
||||||
grunt.loadNpmTasks('grunt-browserify');
|
grunt.loadNpmTasks('grunt-browserify');
|
||||||
grunt.loadNpmTasks('grunt-jasmine-node');
|
grunt.loadNpmTasks('grunt-jasmine-node');
|
||||||
|
@ -165,12 +170,12 @@ module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-rm');
|
grunt.loadNpmTasks('grunt-rm');
|
||||||
grunt.loadNpmTasks('grunt-shell');
|
grunt.loadNpmTasks('grunt-shell');
|
||||||
|
|
||||||
//grunt.registerTask('default', 'lint jasmine_node browserify rm min hash compliment');
|
grunt.registerTask('build', 'rm browserify min hash buildIndex shell');
|
||||||
grunt.registerTask('build', 'rm browserify min hash buildIndex');
|
grunt.registerTask('fastBuild', 'rm browserify hash buildIndex shell');
|
||||||
grunt.registerTask('fastBuild', 'rm browserify hash buildDebugIndex');
|
|
||||||
grunt.registerTask('default', 'lint jasmine_node build compliment');
|
grunt.registerTask('default', 'lint jasmine_node build compliment');
|
||||||
|
|
||||||
grunt.registerTask('watching', 'build lint');
|
grunt.registerTask('watching', 'fastBuild lint');
|
||||||
grunt.registerTask('test', 'jasmine_node');
|
grunt.registerTask('test', 'jasmine_node');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue