diff --git a/app/index.js b/app/index.js index 2cc52dd..fe27985 100644 --- a/app/index.js +++ b/app/index.js @@ -115,9 +115,7 @@ var Generator = module.exports = function Generator(args, options) { 'test/mock/**/*.' + jsExt, 'test/spec/**/*.' + jsExt ].join(','), - 'bower-components-path': path.join( - this.options.appPath, 'bower_components' - ) + 'bower-components-path': 'bower_components' } }); @@ -312,7 +310,6 @@ Generator.prototype.packageFiles = function packageFiles() { this.coffee = this.env.options.coffee; this.template('root/_bower.json', 'bower.json'); this.template('root/_bowerrc', '.bowerrc'); - this.template('root/gitignore', '.gitignore'); this.template('root/_package.json', 'package.json'); this.template('root/_Gruntfile.js', 'Gruntfile.js'); }; diff --git a/common/index.js b/common/index.js index fab748b..526c45c 100644 --- a/common/index.js +++ b/common/index.js @@ -17,6 +17,7 @@ Generator.prototype.setupEnv = function setupEnv() { this.copy('.editorconfig'); this.copy('.gitattributes'); this.copy('.jshintrc'); + this.copy('gitignore', '.gitignore'); this.directory('test'); this.sourceRoot(join(__dirname, '../templates/common')); diff --git a/templates/common/root/_Gruntfile.js b/templates/common/root/_Gruntfile.js index da23cf3..bb19bf0 100644 --- a/templates/common/root/_Gruntfile.js +++ b/templates/common/root/_Gruntfile.js @@ -15,15 +15,17 @@ module.exports = function (grunt) { // Time how long tasks take. Can help when optimizing build times require('time-grunt')(grunt); + // Configurable paths for the application + var appConfig = { + app: require('./bower.json').appPath || 'app', + dist: 'dist' + }; + // Define the configuration for all the tasks grunt.initConfig({ // Project settings - yeoman: { - // configurable paths - app: require('./bower.json').appPath || 'app', - dist: 'dist' - }, + yeoman: appConfig, // Watches files for changes and runs tasks based on the changed files watch: { @@ -85,20 +87,32 @@ module.exports = function (grunt) { livereload: { options: { open: true, - base: [ - '.tmp', - '<%%= yeoman.app %>' - ] + middleware: function (connect) { + return [ + connect.static('.tmp'), + connect().use( + '/bower_components', + connect.static('./bower_components') + ), + connect.static(appConfig.app) + ]; + } } }, test: { options: { port: 9001, - base: [ - '.tmp', - 'test', - '<%%= yeoman.app %>' - ] + middleware: function (connect) { + return [ + connect.static('.tmp'), + connect.static('test'), + connect().use( + '/bower_components', + connect.static('./bower_components') + ), + connect.static(appConfig.app) + ]; + } } }, dist: { @@ -163,11 +177,11 @@ module.exports = function (grunt) { wiredep: { app: { src: ['<%%= yeoman.app %>/index.html'], - ignorePath: new RegExp('^<%%= yeoman.app %>/') + ignorePath: new RegExp('^<%%= yeoman.app %>/|../') }<% if (compass) { %>, sass: { - src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], - ignorePath: '<%%= yeoman.app %>/bower_components/' + src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], + ignorePath: /(\.\.\/){1,2}bower_components\// }<% } %> },<% if (coffee) { %> @@ -206,7 +220,7 @@ module.exports = function (grunt) { imagesDir: '<%%= yeoman.app %>/images', javascriptsDir: '<%%= yeoman.app %>/scripts', fontsDir: '<%%= yeoman.app %>/styles/fonts', - importPath: '<%%= yeoman.app %>/bower_components', + importPath: './bower_components', httpImagesPath: '/images', httpGeneratedImagesPath: '/images/generated', httpFontsPath: '/styles/fonts', @@ -376,9 +390,10 @@ module.exports = function (grunt) { src: ['generated/*'] }<% if (bootstrap) { %>, { expand: true, - cwd: '<%%= yeoman.app %><% - if (!compassBootstrap) { - %>/bower_components/bootstrap/dist<% + cwd: '<% if (!compassBootstrap) { + %>bower_components/bootstrap/dist<% + } else { + %>.<% } %>', src: '<% if (compassBootstrap) { %>bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap<% diff --git a/templates/common/root/_bowerrc b/templates/common/root/_bowerrc index acec9ae..69fad35 100644 --- a/templates/common/root/_bowerrc +++ b/templates/common/root/_bowerrc @@ -1,3 +1,3 @@ { - "directory": "<%= appPath %>/bower_components" + "directory": "bower_components" } diff --git a/templates/common/root/gitignore b/templates/common/root/gitignore index 3f13bd9..a22a458 100644 --- a/templates/common/root/gitignore +++ b/templates/common/root/gitignore @@ -2,4 +2,4 @@ node_modules dist .tmp .sass-cache -<%= appPath %>/bower_components +bower_components