diff --git a/app/index.js b/app/index.js index c679afd8..f865d3a3 100644 --- a/app/index.js +++ b/app/index.js @@ -116,32 +116,39 @@ module.exports = yeoman.generators.Base.extend({ mainStylesheet: function () { var css = 'main.' + (this.includeSass ? 's' : '') + 'css'; - this.copy(css, 'app/styles/' + css); + this.template(css, 'app/styles/' + css); }, - writeIndex: function () { + writeIndex: function () { this.indexFile = this.readFileAsString(join(this.sourceRoot(), 'index.html')); this.indexFile = this.engine(this.indexFile, this); // wire Bootstrap plugins if (this.includeBootstrap) { - var bs = '../bower_components/bootstrap'; + var bs = 'bower_components/bootstrap'; bs += this.includeSass ? '-sass-official/vendor/assets/javascripts/bootstrap/' : '/js/'; - this.indexFile = this.appendScripts(this.indexFile, 'scripts/plugins.js', [ - bs + 'affix.js', - bs + 'alert.js', - bs + 'dropdown.js', - bs + 'tooltip.js', - bs + 'modal.js', - bs + 'transition.js', - bs + 'button.js', - bs + 'popover.js', - bs + 'carousel.js', - bs + 'scrollspy.js', - bs + 'collapse.js', - bs + 'tab.js' - ]); + + this.indexFile = this.appendFiles({ + html: this.indexFile, + fileType: 'js', + optimizedPath: 'scripts/plugins.js', + sourceFileList: [ + bs + 'affix.js', + bs + 'alert.js', + bs + 'dropdown.js', + bs + 'tooltip.js', + bs + 'modal.js', + bs + 'transition.js', + bs + 'button.js', + bs + 'popover.js', + bs + 'carousel.js', + bs + 'scrollspy.js', + bs + 'collapse.js', + bs + 'tab.js' + ], + searchPath: '.' + }); } this.indexFile = this.appendFiles({ @@ -149,7 +156,7 @@ module.exports = yeoman.generators.Base.extend({ fileType: 'js', optimizedPath: 'scripts/main.js', sourceFileList: ['scripts/main.js'], - searchPath: '{app,.tmp}' + searchPath: ['app', '.tmp'] }); }, diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js index d5178105..1b0939d9 100644 --- a/app/templates/Gruntfile.js +++ b/app/templates/Gruntfile.js @@ -191,6 +191,13 @@ module.exports = function (grunt) { // Compiles Sass to CSS and generates necessary files if requested sass: { + options: {<% if (includeLibSass) { %> + sourceMap: true, + includePaths: ['bower_components'] + <% } else { %> + sourcemap: true, + loadPath: 'bower_components' + <% } %>}, dist: { files: [{ expand: true, @@ -229,12 +236,14 @@ module.exports = function (grunt) { // Automatically inject Bower components into the HTML file wiredep: { app: { + ignorePath: new RegExp('^<%%= config.app %>/|../'), src: ['<%%= config.app %>/index.html']<% if (includeBootstrap) { %>,<% if (includeSass) { %> exclude: ['bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js']<% } else { %> exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']<% } } %> }<% if (includeSass) { %>, sass: { - src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'] + src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'], + ignorePath: /(\.\.\/){1,2}bower_components\// }<% } %> }, @@ -359,11 +368,18 @@ module.exports = function (grunt) { ] }<% if (includeBootstrap) { %>, { expand: true, - dot: true,<% if (includeSass) { %> - cwd: 'bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/',<% } else { %> - cwd: 'bower_components/bootstrap/dist/fonts/',<% } %> - src: ['*.*'], - dest: '<%%= config.dist %>/fonts' + dot: true, + cwd: '<% if (includeSass) { + %>.<% + } else { + %>bower_components/bootstrap/dist<% + } %>', + src: '<% if (includeSass) { + %>bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/*<% + } else { + %>fonts/*<% + } %>', + dest: '<%%= config.dist %>' }<% } %>] }, styles: { @@ -424,6 +440,7 @@ module.exports = function (grunt) { grunt.task.run([ 'clean:server', + 'wiredep', 'concurrent:server', 'autoprefixer', 'connect:livereload', @@ -454,6 +471,7 @@ module.exports = function (grunt) { grunt.registerTask('build', [ 'clean:dist', + 'wiredep', 'useminPrepare', 'concurrent:dist', 'autoprefixer', diff --git a/app/templates/_bower.json b/app/templates/_bower.json index 81cb61f8..6082e754 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -3,9 +3,9 @@ "private": true, "dependencies": {<% if (includeBootstrap) { if (includeSass) { %> "bootstrap-sass-official": "~3.1.0",<% } else { %> - "bootstrap": "~3.0.3",<% }} if (includeModernizr) { %> - "modernizr": "~2.6.2",<% } %> - "jquery": "~1.11.0" + "bootstrap": "~3.1.1",<% }} if (includeModernizr) { %> + "modernizr": "~2.8.2",<% } %> + "jquery": "~1.11.1" }, "devDependencies": {} } diff --git a/app/templates/index.html b/app/templates/index.html index 6c615526..5931b5a3 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -7,16 +7,16 @@ - + - <% if (includeBootstrap && !includeSass) { %><% } %> + <% if (includeBootstrap && !includeSass) { %><% } %> <% if (includeModernizr) { %> - + <% } %> @@ -77,9 +77,9 @@