diff --git a/all/index.js b/all/index.js index a125283..b59ea11 100644 --- a/all/index.js +++ b/all/index.js @@ -1,6 +1,8 @@ var path = require('path'); var util = require('util'); +var mkdirp = require('mkdirp'); var yeoman = require('yeoman-generator'); +var pascalCase = require('pascal-case'); var BackboneGenerator = yeoman.generators.Base.extend({ constructor: function () { @@ -8,7 +10,7 @@ var BackboneGenerator = yeoman.generators.Base.extend({ this.argument('app_name', { type: String, required: false }); this.appname = this.app_name || this.appname; - this.appname = this._.classify(this.appname); + this.appname = pascalCase(this.appname); this.env.options.appPath = this.options.appPath || 'app'; this.config.set('appPath', this.env.options.appPath); @@ -51,9 +53,10 @@ var BackboneGenerator = yeoman.generators.Base.extend({ writing: { createDirLayout: function () { + var done = this.async(); this.dirs.forEach(function (dir) { this.log.create('app/scripts/' + dir); - this.mkdir(path.join('app/scripts', dir)); + mkdirp(path.join('app/scripts', dir), done); }.bind(this)); }, diff --git a/app/index.js b/app/index.js index 5a18af0..569b09e 100644 --- a/app/index.js +++ b/app/index.js @@ -1,9 +1,12 @@ 'use strict'; var util = require('util'); var path = require('path'); +var ejs = require('ejs'); +var htmlWiring = require('html-wiring'); +var mkdirp = require('mkdirp'); +var pascalCase = require('pascal-case'); +var paramCase = require('param-case'); var yeoman = require('yeoman-generator'); -var scriptBase = require('../script-base'); -var backboneUtils = require('../util.js'); var BackboneGenerator = yeoman.generators.Base.extend({ constructor: function () { @@ -40,7 +43,7 @@ var BackboneGenerator = yeoman.generators.Base.extend({ this.argument('app_name', { type: String, required: false }); this.appname = this.app_name || this.appname; - this.appname = this._.classify(this.appname); + this.appname = pascalCase(this.appname); this.env.options.appPath = this.options.appPath || 'app'; this.config.set('appPath', this.env.options.appPath); @@ -58,7 +61,7 @@ var BackboneGenerator = yeoman.generators.Base.extend({ includeRequireJS: this.includeRequireJS }); - this.indexFile = this.readFileAsString(path.join(this.sourceRoot(), 'index.html')); + this.indexFile = htmlWiring.readFileAsString(this.templatePath('index.html')); }, prompting: function () { @@ -120,29 +123,87 @@ var BackboneGenerator = yeoman.generators.Base.extend({ writing: { git: function () { - this.template('gitignore', '.gitignore'); - this.copy('gitattributes', '.gitattributes'); + this.fs.copyTpl( + this.templatePath('gitignore'), + this.destinationPath('.gitignore'), + { + appPath: this.env.options.appPath + } + ); + this.fs.copyTpl( + this.templatePath('gitattributes'), + this.destinationPath('.gitattributes') + ); }, bower: function () { - this.template('bowerrc', '.bowerrc'); - this.copy('_bower.json', 'bower.json'); + this.fs.copyTpl( + this.templatePath('bowerrc'), + this.destinationPath('.bowerrc'), + { + appPath: this.env.options.appPath + } + ); + this.fs.copyTpl( + this.templatePath('_bower.json'), + this.destinationPath('bower.json'), + { + appSlugName: paramCase(this.appname), + sassBootstrap: this.sassBootstrap, + includeRequireJS: this.includeRequireJS, + includeModernizr: this.includeModernizr, + templateFramework: this.templateFramework + } + ); }, jshint: function () { - this.copy('jshintrc', '.jshintrc'); + this.fs.copyTpl( + this.templatePath('jshintrc'), + this.destinationPath('.jshintrc'), + { + appName: this.appname, + appSlugName: paramCase(this.appname), + includeRequireJS: this.includeRequireJS + } + ); }, editorConfig: function () { - this.copy('editorconfig', '.editorconfig'); + this.fs.copyTpl( + this.templatePath('editorconfig'), + this.destinationPath('.editorconfig') + ); }, gruntfile: function () { - this.template('Gruntfile.js'); + this.fs.copyTpl( + this.templatePath('Gruntfile.js'), + this.destinationPath('Gruntfile.js'), + { + appPath: this.env.options.appPath, + hasCoffee: this.options.coffee, + includeRequireJS: this.includeRequireJS, + sassBootstrap: this.sassBootstrap, + templateFramework: this.templateFramework, + testFramework: this.testFramework + } + ); }, packageJSON: function () { - this.template('_package.json', 'package.json'); + this.fs.copyTpl( + this.templatePath('_package.json'), + this.destinationPath('package.json'), + { + appSlugName: paramCase(this.appname), + hasCoffee: this.options.coffee, + includeRequireJS: this.includeRequireJS, + sassBootstrap: this.sassBootstrap, + templateFramework: this.templateFramework, + testFramework: this.testFramework + } + ); }, mainStylesheet: function () { @@ -152,10 +213,16 @@ var BackboneGenerator = yeoman.generators.Base.extend({ ]; var ext = '.css'; if (this.sassBootstrap) { - this.template('main.scss', this.env.options.appPath + '/styles/main.scss'); + this.fs.copyTpl( + this.templatePath('main.scss'), + this.destinationPath(this.env.options.appPath + '/styles/main.scss') + ); return; } - this.write(this.env.options.appPath + '/styles/main' + ext, contentText.join('\n')); + this.fs.write( + this.destinationPath(this.env.options.appPath + '/styles/main' + ext), + contentText.join('\n') + ); }, writeIndex: function () { @@ -163,8 +230,16 @@ var BackboneGenerator = yeoman.generators.Base.extend({ return; } - this.indexFile = this.readFileAsString(path.join(this.sourceRoot(), 'index.html')); - this.indexFile = this.engine(this.indexFile, this); + this.indexFile = htmlWiring.readFileAsString(this.templatePath('index.html')); + this.indexFile = ejs.render( + this.indexFile, + { + appName: this.appname, + includeModernizr: this.includeModernizr, + includeRequireJS: this.includeRequireJS, + sassBootstrap: this.sassBootstrap + } + ); var vendorJS = [ 'bower_components/jquery/dist/jquery.js', @@ -176,11 +251,11 @@ var BackboneGenerator = yeoman.generators.Base.extend({ vendorJS.push('bower_components/handlebars/handlebars.js'); } - this.indexFile = this.appendScripts(this.indexFile, 'scripts/vendor.js', vendorJS); + this.indexFile = htmlWiring.appendScripts(this.indexFile, 'scripts/vendor.js', vendorJS); if (this.sassBootstrap) { // wire Twitter Bootstrap plugins - this.indexFile = this.appendScripts(this.indexFile, 'scripts/plugins.js', [ + this.indexFile = htmlWiring.appendScripts(this.indexFile, 'scripts/plugins.js', [ 'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/affix.js', 'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/alert.js', 'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap/button.js', @@ -196,7 +271,7 @@ var BackboneGenerator = yeoman.generators.Base.extend({ ]); } - this.indexFile = this.appendFiles({ + this.indexFile = htmlWiring.appendFiles({ html: this.indexFile, fileType: 'js', searchPath: ['.tmp', this.env.options.appPath], @@ -212,38 +287,81 @@ var BackboneGenerator = yeoman.generators.Base.extend({ if (!this.includeRequireJS) { return; } - this.indexFile = this.readFileAsString(path.join(this.sourceRoot(), 'index.html')); - this.indexFile = this.engine(this.indexFile, this); - - this.indexFile = this.appendScripts(this.indexFile, 'scripts/main.js', [ + this.indexFile = htmlWiring.readFileAsString(this.templatePath('index.html')); + this.indexFile = ejs.render( + this.indexFile, + { + appName: this.appname, + includeModernizr: this.includeModernizr, + includeRequireJS: this.includeRequireJS, + sassBootstrap: this.sassBootstrap + } + ); + + this.indexFile = htmlWiring.appendScripts(this.indexFile, 'scripts/main.js', [ 'bower_components/requirejs/require.js' ], {'data-main': 'scripts/main'}); }, setupEnv: function () { - this.mkdir(this.env.options.appPath); - this.mkdir(this.env.options.appPath + '/scripts'); - this.mkdir(this.env.options.appPath + '/scripts/vendor/'); - this.mkdir(this.env.options.appPath + '/styles'); - this.mkdir(this.env.options.appPath + '/images'); - this.copy('app/404.html', this.env.options.appPath + '/404.html'); - this.copy('app/favicon.ico', this.env.options.appPath + '/favicon.ico'); - this.copy('app/robots.txt', this.env.options.appPath + '/robots.txt'); - this.write(this.env.options.appPath + '/index.html', this.indexFile); + mkdirp.sync( + this.templatePath(this.env.options.appPath) + ); + mkdirp.sync( + this.templatePath(this.env.options.appPath + '/scripts') + ); + mkdirp.sync( + this.templatePath(this.env.options.appPath + '/scripts/vendor/') + ); + mkdirp.sync( + this.templatePath(this.env.options.appPath + '/styles') + ); + mkdirp.sync( + this.templatePath(this.env.options.appPath + '/images') + ); + this.fs.copyTpl( + this.templatePath('app/404.html'), + this.destinationPath(this.env.options.appPath + '/404.html') + ); + this.fs.copyTpl( + this.templatePath('app/favicon.ico'), + this.destinationPath(this.env.options.appPath + '/favicon.ico') + ); + this.fs.copyTpl( + this.templatePath('app/robots.txt'), + this.destinationPath(this.env.options.appPath + '/robots.txt') + ); + this.fs.write( + this.destinationPath(path.join(this.env.options.appPath, '/index.html')), + this.indexFile + ); }, createRequireJsAppFile: function () { if (!this.includeRequireJS) { return; } - this._writeTemplate('requirejs_app', this.env.options.appPath + '/scripts/main'); + this._writeTemplate( + 'requirejs_app', + this.env.options.appPath + '/scripts/main', + { + sassBootstrap: this.sassBootstrap, + templateFramework: this.templateFramework + } + ); }, createAppFile: function () { if (this.includeRequireJS) { return; } - this._writeTemplate('app', this.env.options.appPath + '/scripts/main'); + this._writeTemplate( + 'app', + this.env.options.appPath + '/scripts/main', + { + appSlugName: paramCase(this.appname) + } + ); }, composeTest: function () { @@ -275,7 +393,11 @@ var BackboneGenerator = yeoman.generators.Base.extend({ } var ext = this.scriptSuffix; - this.template(source + ext, destination + ext, data); + this.fs.copyTpl( + this.templatePath(source + ext), + this.destinationPath(destination + ext), + data + ); }, install: function () { diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js index fb22d0e..17fc186 100644 --- a/app/templates/Gruntfile.js +++ b/app/templates/Gruntfile.js @@ -25,7 +25,7 @@ module.exports = function (grunt) { // configurable paths var yeomanConfig = { - app: '<%= env.options.appPath %>', + app: '<%= appPath %>', dist: 'dist' }; @@ -35,7 +35,7 @@ module.exports = function (grunt) { options: { nospawn: true, livereload: LIVERELOAD_PORT - },<% if (options.coffee) { %> + },<% if (hasCoffee) { %> coffee: { files: ['<%%= yeoman.app %>/scripts/{,*/}*.coffee'], tasks: ['coffee:dist'] @@ -147,7 +147,8 @@ module.exports = function (grunt) { '!<%%= yeoman.app %>/scripts/vendor/*', 'test/spec/{,*/}*.js' ] - }<% if (testFramework === 'mocha') { %>, + }, +<% if (testFramework === 'mocha') { -%> mocha: { all: { options: { @@ -155,10 +156,11 @@ module.exports = function (grunt) { urls: ['http://localhost:<%%= connect.test.options.port %>/index.html'] } } - }<% } else { %>, + }, +<% } else { -%> jasmine: { all:{ - src : '<%= yeoman.app %>/scripts/{,*/}*.js', + src : '<%%= yeoman.app %>/scripts/{,*/}*.js', options: { keepRunner: true, specs : 'test/spec/**/*.js', @@ -170,7 +172,9 @@ module.exports = function (grunt) { ] } } - }<% } %>,<% if (options.coffee) { %> + }, +<% } -%> +<% if (hasCoffee) { -%> coffee: { dist: { files: [{ @@ -192,7 +196,9 @@ module.exports = function (grunt) { ext: '.js' }] } - },<% } %><% if (sassBootstrap) { %> + }, +<% } -%> +<% if (sassBootstrap) { -%> sass: { options: { sourceMap: true, @@ -216,14 +222,22 @@ module.exports = function (grunt) { ext: '.css' }] } - },<% } %><% if (includeRequireJS) { %> + }, +<% } -%> +<% if (includeRequireJS) { -%> requirejs: { dist: { // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js - options: {<% if (options.coffee) { %> + options: { +<% if (hasCoffee) { -%> // `name` and `out` is set by grunt-usemin - baseUrl: '.tmp/scripts',<% } else { %> - baseUrl: '<%%= yeoman.app %>/scripts',<% } %> + baseUrl: '.tmp/scripts', +<% } else { -%> + baseUrl: '<%%= yeoman.app %>/scripts', +<% } -%> +<% if (templateFramework !== 'handlebars') { -%> + wrap: true, +<% } -%> optimize: 'none', paths: { 'templates': '../../.tmp/scripts/templates', @@ -237,18 +251,19 @@ module.exports = function (grunt) { // required to support SourceMaps // http://requirejs.org/docs/errors.html#sourcemapcomments preserveLicenseComments: false, - useStrict: true<% if (templateFramework !== 'handlebars') { %>, - wrap: true<% } %> + useStrict: true //uglify2: {} // https://github.com/mishoo/UglifyJS2 } } - },<% } else { %> + }, +<% } else { -%> // not enabled since usemin task does concat and uglify // check index.html to edit your build targets // enable this task if you prefer defining your build targets here /*uglify: { dist: {} - },*/<% } %> + },*/ +<% } -%> useminPrepare: { html: '<%%= yeoman.app %>/index.html', options: { @@ -313,53 +328,68 @@ module.exports = function (grunt) { src: [ '*.{ico,txt}', 'images/{,*/}*.{webp,gif}', - 'styles/fonts/{,*/}*.*',<% if (sassBootstrap) { %> - 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*.*'<% } %> + 'styles/fonts/{,*/}*.*', +<% if (sassBootstrap) { -%> + 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*.*' +<% } -%> ] }, { src: 'node_modules/apache-server-configs/dist/.htaccess', dest: '<%%= yeoman.dist %>/.htaccess' }] } - },<% if (includeRequireJS) { %> + }, +<% if (includeRequireJS) { -%> bower: { all: { rjsConfig: '<%%= yeoman.app %>/scripts/main.js' } - },<% } %><% if (templateFramework === 'mustache') { %> + }, +<% } -%> +<% if (templateFramework === 'mustache') { -%> mustache: { files: { src: '<%%= yeoman.app %>/scripts/templates/', dest: '.tmp/scripts/templates.js', - options: {<% if (includeRequireJS) { %> + options: { +<% if (includeRequireJS) { -%> prefix: 'define(function() { this.JST = ', - postfix: '; return this.JST;});'<% } else { %> + postfix: '; return this.JST;});' +<% } else { -%> prefix: 'this.JST = ', - postfix: ';'<% } %> + postfix: ';' +<% } -%> } } - }<% } else if (templateFramework === 'handlebars') { %> + } +<% } else if (templateFramework === 'handlebars') { -%> handlebars: { compile: { options: { - namespace: 'JST'<% if (includeRequireJS) { %>, - amd: true<% } %> +<% if (includeRequireJS) { -%> + amd: true, +<% } -%> + namespace: 'JST' }, files: { '.tmp/scripts/templates.js': ['<%%= yeoman.app %>/scripts/templates/*.hbs'] } } - }<% } else { %> - jst: {<% if (includeRequireJS) { %> + } +<% } else { -%> + jst: { +<% if (includeRequireJS) { -%> options: { amd: true - },<% } %> + }, +<% } -%> compile: { files: { '.tmp/scripts/templates.js': ['<%%= yeoman.app %>/scripts/templates/*.ejs'] } } - }<% } %>, + }, +<% } -%> rev: { dist: { files: { @@ -367,8 +397,10 @@ module.exports = function (grunt) { '<%%= yeoman.dist %>/scripts/{,*/}*.js', '<%%= yeoman.dist %>/styles/{,*/}*.css', '<%%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}', - '<%= yeoman.dist %>/styles/fonts/{,*/}*.*',<% if (sassBootstrap) { %> - 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*.*'<% } %> + '<%%= yeoman.dist %>/styles/fonts/{,*/}*.*', +<% if (sassBootstrap) { -%> + 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*.*' +<% } -%> ] } } @@ -391,13 +423,21 @@ module.exports = function (grunt) { if (target === 'test') { return grunt.task.run([ - 'clean:server',<% if (options.coffee) { %> - 'coffee',<% } %> - 'createDefaultTemplate',<% if (templateFramework === 'mustache' ) { %> - 'mustache',<% } else if (templateFramework === 'handlebars') { %> - 'handlebars',<% } else { %> - 'jst',<% } %><% if (sassBootstrap) { %> - 'sass:server',<% } %> + 'clean:server', +<% if (hasCoffee) { -%> + 'coffee', +<% } -%> + 'createDefaultTemplate', +<% if (templateFramework === 'mustache' ) { -%> + 'mustache', +<% } else if (templateFramework === 'handlebars') { -%> + 'handlebars', +<% } else { -%> + 'jst', +<% } -%> +<% if (sassBootstrap) { -%> + 'sass:server', +<% } -%> 'connect:test', 'open:test', 'watch' @@ -405,13 +445,21 @@ module.exports = function (grunt) { } grunt.task.run([ - 'clean:server',<% if (options.coffee) { %> - 'coffee:dist',<% } %> - 'createDefaultTemplate',<% if (templateFramework === 'mustache') { %> - 'mustache',<% } else if (templateFramework === 'handlebars') { %> - 'handlebars',<% } else { %> - 'jst',<% } %><% if (sassBootstrap) { %> - 'sass:server',<% } %> + 'clean:server', +<% if (hasCoffee) { -%> + 'coffee:dist', +<% } -%> + 'createDefaultTemplate', +<% if (templateFramework === 'mustache') { -%> + 'mustache', +<% } else if (templateFramework === 'handlebars') { -%> + 'handlebars', +<% } else { -%> + 'jst', +<% } -%> +<% if (sassBootstrap) { -%> + 'sass:server', +<% } -%> 'connect:livereload', 'open:server', 'watch' @@ -421,16 +469,27 @@ module.exports = function (grunt) { grunt.registerTask('test', function (isConnected) { isConnected = Boolean(isConnected); var testTasks = [ - 'clean:server',<% if (options.coffee) { %> - 'coffee',<% } %> - 'createDefaultTemplate',<% if (templateFramework === 'mustache' ) { %> - 'mustache',<% } else if (templateFramework === 'handlebars') { %> - 'handlebars',<% } else { %> - 'jst',<% } %><% if (sassBootstrap) { %> - 'sass',<% } %><% if(testFramework === 'mocha') { %> + 'clean:server', +<% if (hasCoffee) { -%> + 'coffee', +<% } -%> + 'createDefaultTemplate', +<% if (templateFramework === 'mustache' ) { -%> + 'mustache', +<% } else if (templateFramework === 'handlebars') { -%> + 'handlebars', +<% } else { -%> + 'jst', +<% } -%> +<% if (sassBootstrap) { -%> + 'sass', +<% } -%> +<% if(testFramework === 'mocha') { -%> 'connect:test', - 'mocha',<% } else { %> - 'jasmine'<% } %> + 'mocha' +<% } else { -%> + 'jasmine' +<% } -%> ]; if(!isConnected) { @@ -443,15 +502,25 @@ module.exports = function (grunt) { }); grunt.registerTask('build', [ - 'clean:dist',<% if (options.coffee) { %> - 'coffee',<% } %> - 'createDefaultTemplate',<% if (templateFramework === 'mustache' ) { %> - 'mustache',<% } else if (templateFramework === 'handlebars') { %> - 'handlebars',<% } else { %> - 'jst',<% } %><% if (sassBootstrap) { %> - 'sass:dist',<% } %> - 'useminPrepare',<% if (includeRequireJS) { %> - 'requirejs',<% } %> + 'clean:dist', +<% if (hasCoffee) { -%> + 'coffee', +<% } -%> + 'createDefaultTemplate', +<% if (templateFramework === 'mustache' ) { -%> + 'mustache', +<% } else if (templateFramework === 'handlebars') { -%> + 'handlebars', +<% } else { -%> + 'jst', +<% } -%> +<% if (sassBootstrap) { -%> + 'sass:dist', +<% } -%> + 'useminPrepare', +<% if (includeRequireJS) { -%> + 'requirejs', +<% } -%> 'imagemin', 'htmlmin', 'concat', diff --git a/app/templates/_bower.json b/app/templates/_bower.json index 294af06..9c8949e 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -1,15 +1,21 @@ { - "name": "<%= _.slugify(appname) %>", + "name": "<%= appSlugName %>", "version": "0.0.0", - "dependencies": {<% if (sassBootstrap) { %> - "bootstrap-sass-official": "~3.3.1",<% } %> + "dependencies": { +<% if (sassBootstrap) { -%> + "bootstrap-sass-official": "~3.3.1", +<% } -%> "jquery": "~2.1.0", - "lodash": "~2.4.1", - "backbone": "~1.1.0"<% if (includeRequireJS) { %>, + "backbone": "~1.1.0", +<% if (includeRequireJS) { -%> "requirejs": "~2.1.10", - "requirejs-text": "~2.0.10"<% } if (includeModernizr) { %>, - "modernizr": "~2.7.1"<% } if (templateFramework === 'handlebars') { %>, - "handlebars": "~1.3.0"<% } %> + "requirejs-text": "~2.0.10", +<% } if (includeModernizr) { -%> + "modernizr": "~2.7.1", +<% } if (templateFramework === 'handlebars') { -%> + "handlebars": "~1.3.0" +<% } -%> + "lodash": "~2.4.1" }, "devDependencies": {} } diff --git a/app/templates/_package.json b/app/templates/_package.json index 67cea00..190dca6 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -1,16 +1,22 @@ { - "name": "<%= _.slugify(appname) %>", + "name": "<%= appSlugName %>", "version": "0.0.0", "dependencies": {}, "devDependencies": { "apache-server-configs": "^2.8.0", "grunt": "^0.4.5", "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-concat": "^0.5.0",<% if (options.coffee) { %> - "grunt-contrib-coffee": "^0.11.0",<% } %><% if (templateFramework === 'mustache') { %> - "grunt-mustache": "^0.1.7",<% } else if (templateFramework === 'handlebars') { %> - "grunt-contrib-handlebars": "^0.8.0",<% } else { %> - "grunt-contrib-jst": "^0.6.0",<% } %> + "grunt-contrib-concat": "^0.5.0", +<% if (hasCoffee) { -%> + "grunt-contrib-coffee": "^0.11.0", +<% } -%> +<% if (templateFramework === 'mustache') { -%> + "grunt-mustache": "^0.1.7", +<% } else if (templateFramework === 'handlebars') { -%> + "grunt-contrib-handlebars": "^0.8.0", +<% } else { -%> + "grunt-contrib-jst": "^0.6.0", +<% } -%> "grunt-contrib-uglify": "^0.6.0", "grunt-contrib-jshint": "^0.10.0", "grunt-contrib-cssmin": "^0.10.0", @@ -18,15 +24,22 @@ "grunt-contrib-clean": "^0.6.0", "grunt-contrib-htmlmin": "^0.3.0", "grunt-contrib-imagemin": "^0.9.2", - "grunt-contrib-watch": "^0.6.1",<% if (testFramework === 'jasmine') { %> - "grunt-contrib-jasmine": "^0.8.0",<% }else{ %> - "grunt-mocha": "^0.4.11",<% } %> - "grunt-usemin": "^2.4.0",<% if(includeRequireJS){ %> + "grunt-contrib-watch": "^0.6.1", +<% if (testFramework === 'jasmine') { -%> + "grunt-contrib-jasmine": "^0.8.0", +<% }else{ -%> + "grunt-mocha": "^0.4.11", +<% } -%> + "grunt-usemin": "^2.4.0", +<% if(includeRequireJS){ -%> "grunt-bower-requirejs": "^1.1.0", - "grunt-requirejs": "^0.4.2",<% } %> + "grunt-requirejs": "^0.4.2", +<% } -%> "grunt-rev": "^0.1.0", - "grunt-open": "^0.2.3",<% if (sassBootstrap) { %> - "grunt-sass": "^1.0.0",<% } %> + "grunt-open": "^0.2.3", +<% if (sassBootstrap) { -%> + "grunt-sass": "^1.0.0", +<% } -%> "connect-livereload": "^0.4.0", "jit-grunt": "^0.9.1", "time-grunt": "^1.0.0", diff --git a/app/templates/app.coffee b/app/templates/app.coffee index 1a552c4..ff4ff93 100644 --- a/app/templates/app.coffee +++ b/app/templates/app.coffee @@ -1,4 +1,4 @@ -window.<%= _.camelize(appname) %> = +window.<%= appSlugName %> = Models: {} Collections: {} Views: {} @@ -9,4 +9,4 @@ window.<%= _.camelize(appname) %> = $ -> 'use strict' - <%= _.camelize(appname) %>.init(); + <%= appSlugName %>.init(); diff --git a/app/templates/app.js b/app/templates/app.js index a92b7d2..625e63d 100644 --- a/app/templates/app.js +++ b/app/templates/app.js @@ -1,7 +1,7 @@ -/*global <%= _.camelize(appname) %>, $*/ +/*global <%= appSlugName %>, $*/ -window.<%= _.camelize(appname) %> = { +window.<%= appSlugName %> = { Models: {}, Collections: {}, Views: {}, @@ -14,5 +14,5 @@ window.<%= _.camelize(appname) %> = { $(document).ready(function () { 'use strict'; - <%= _.camelize(appname) %>.init(); + <%= appSlugName %>.init(); }); diff --git a/app/templates/bowerrc b/app/templates/bowerrc index 8f23eaf..acec9ae 100644 --- a/app/templates/bowerrc +++ b/app/templates/bowerrc @@ -1,3 +1,3 @@ { - "directory": "<%= env.options.appPath %>/bower_components" + "directory": "<%= appPath %>/bower_components" } diff --git a/app/templates/gitignore b/app/templates/gitignore index cd74fc3..deeedbb 100644 --- a/app/templates/gitignore +++ b/app/templates/gitignore @@ -2,6 +2,6 @@ node_modules dist test/temp .sass-cache -<%= env.options.appPath %>/bower_components +<%= appPath %>/bower_components .tmp test/bower_components/ diff --git a/app/templates/index.html b/app/templates/index.html index bf36532..06c7090 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -2,23 +2,24 @@
-Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
- <% if (includeModernizr) { %> + +<% if (includeModernizr) { -%>Modernizr is an open-source JavaScript library that helps you build the next generation of HTML5 and CSS3-powered websites.
- <% } %> +<% } -%>A utility library delivering consistency, customization, performance, & extras.
- <% if (includeRequireJS) { %>RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node.
- <% } %> +<% } -%>You now have
@@ -84,11 +87,16 @@