diff --git a/app/index.js b/app/index.js index dacb61b..221950d 100644 --- a/app/index.js +++ b/app/index.js @@ -9,12 +9,8 @@ var XhGenerator = yeoman.generators.Base.extend({ this.pkg = require('../package.json'); this.on('end', function () { - // http://stackoverflow.com/questions/18841273/how-to-run-a-grunt-task-after-my-yeoman-generator-finishes-installing this.installDependencies({ - skipInstall: this.options['skip-install'], - callback: function () { - this.spawnCommand('grunt', ['postinstall']); - }.bind(this) // bind the callback to the parent scope + skipInstall: this.options['skip-install'] }); }); }, diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js index f1938cb..f51db4c 100644 --- a/app/templates/Gruntfile.js +++ b/app/templates/Gruntfile.js @@ -147,9 +147,16 @@ module.exports = function(grunt) { jquery: { cwd: 'src/bower_components/jquery/dist/', src: 'jquery.min.js', - dest: '<%%= xh.src %>/js/', + dest: '<%%= xh.dist %>/js/', expand: true - }, + },<% if (!useModernizr) { %>, + + shiv: { + cwd: 'src/bower_components/html5shiv/dist/', + src: 'html5shiv.min.js', + dest: '<%%= xh.dist %>/js/', + expand: true + },<% } %> fonts: { cwd: '<%%= xh.src %>/fonts/', @@ -181,7 +188,7 @@ module.exports = function(grunt) { js: { cwd: '<%%= xh.src %>/js/', - src: ['main.js', 'jquery.min.js', <% if (useModernizr) { %>'modernizr.min.js'<% } else { %>'html5shiv.min.js'<% } %>], + src: ['main.js'], dest: '<%%= xh.dist %>/js/', expand: true },<% if (isWP) { %> @@ -207,14 +214,7 @@ module.exports = function(grunt) { src: '<%%= xh.build %>', dest: '<%%= xh.src %>/includes/', expand: true - }<% if (!useModernizr) { %>, - - shiv: { - cwd: 'src/bower_components/html5shiv/dist/', - src: 'html5shiv.min.js', - dest: '<%%= xh.src %>/js/', - expand: true - }<% } %> + } }, jshint: { @@ -230,7 +230,7 @@ module.exports = function(grunt) { uglify: { modernizr: { files: { - '<%%= xh.src %>/js/modernizr.min.js': ['src/bower_components/modernizr/modernizr.js'] + '<%%= xh.dist %>/js/modernizr.min.js': ['src/bower_components/modernizr/modernizr.js'] } } },<% } %> @@ -410,8 +410,7 @@ module.exports = function(grunt) { 'copy:xprecise' ]); - grunt.registerTask('build-css', [ - <% if (cssPreprocessor === 'SCSS') { %> + grunt.registerTask('build-css', [<% if (cssPreprocessor === 'SCSS') { %> 'sass',<% } %><% if (cssPreprocessor === 'LESS') { %> 'less',<% } %> 'autoprefixer', @@ -429,6 +428,7 @@ module.exports = function(grunt) { grunt.registerTask('build', [ 'clean:dist', + 'postinstall', 'build-html', 'build-assets', @@ -456,6 +456,7 @@ module.exports = function(grunt) { ]); grunt.registerTask('default', [ + 'postinstall', 'watch' ]); }; diff --git a/app/templates/_package.json b/app/templates/_package.json index 7069e25..7a73be2 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -26,8 +26,5 @@ "grunt-text-replace": "^0.3.11", "grunt-search": "^0.1.4", "grunt-autoprefixer": "^0.7.3" - }, - "scripts": { - "postinstall": "grunt postinstall" } }