From f50d094226fdbf6a7e65ba3783a26efc8544ba08 Mon Sep 17 00:00:00 2001 From: Tyler Henkel Date: Wed, 2 Jul 2014 20:26:38 -0600 Subject: [PATCH] feat(gen): make bootstrap and bootstrap ui optional --- app/index.js | 19 ++++++++++++++++--- app/templates/_bower.json | 8 ++++---- .../app/account(auth)/login/login(less).less | 3 ++- .../app/account(auth)/login/login(sass).scss | 3 ++- app/templates/client/app/app(less).less | 4 ++-- app/templates/client/app/app(sass).scss | 6 +++--- app/templates/karma.conf.js | 4 ++-- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/app/index.js b/app/index.js index 8b97c1b5c..6aca94947 100644 --- a/app/index.js +++ b/app/index.js @@ -87,12 +87,25 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ message: "What Angular router would you like to use?", choices: [ "ngRoute", "uiRouter"], filter: function( val ) { return val.toLowerCase(); } + }, { + type: "confirm", + name: "bootstrap", + message: "Would you like to include Bootstrap?" + }, { + type: "confirm", + name: "uibootstrap", + message: "Would you like to include UI Bootstrap?", + when: function (answers) { + return answers.bootstrap; + } }], function (answers) { this.filters[answers.script] = true; this.filters[answers.markup] = true; this.filters[answers.stylesheet] = true; this.filters[answers.router] = true; - cb(); + if(answers.bootstrap) this.filters[answers.bootstrap] = true; + if(answers.uibootstrap) this.filters[answers.uibootstrap] = true; + cb(); }.bind(this)); }, @@ -209,12 +222,12 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ var angModules = [ "'ngCookies'", "'ngResource'", - "'ngSanitize'", - "'ui.bootstrap'" + "'ngSanitize'" ]; if(this.filters['ngroute']) angModules.push("'ngRoute'"); if(this.filters['socketio']) angModules.push("'btford.socket-io'"); if(this.filters['uirouter']) angModules.push("'ui.router'"); + if(this.filters['uibootstrap']) angModules.push("'ui.bootstrap'"); this.angularModules = "\n " + angModules.join(",\n ") +"\n"; }, diff --git a/app/templates/_bower.json b/app/templates/_bower.json index da84d2b87..4cc6dc4db 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -5,14 +5,14 @@ "angular": ">=1.2.*", "json3": "~3.3.1", "es5-shim": "~3.0.1", - "jquery": "~1.11.0", + "jquery": "~1.11.0",<% if(filters.bootstrap) { %> "bootstrap-sass-official": "~3.1.1", - "bootstrap": "~3.1.1", + "bootstrap": "~3.1.1",<% } %> "angular-resource": ">=1.2.*", "angular-cookies": ">=1.2.*", "angular-sanitize": ">=1.2.*",<% if(filters.ngroute) { %> - "angular-route": ">=1.2.*",<% } %> - "angular-bootstrap": "~0.11.0", + "angular-route": ">=1.2.*",<% } %><% if(filters.uibootstrap) { %> + "angular-bootstrap": "~0.11.0",<% } %> "font-awesome": ">=4.1.0", "lodash": "~2.4.1"<% if(filters.socketio) { %>, "angular-socket-io": "~0.6.0"<% } %><% if(filters.uirouter) { %>, diff --git a/app/templates/client/app/account(auth)/login/login(less).less b/app/templates/client/app/account(auth)/login/login(less).less index e60cc7ff2..fc9e26556 100644 --- a/app/templates/client/app/account(auth)/login/login(less).less +++ b/app/templates/client/app/account(auth)/login/login(less).less @@ -1,3 +1,4 @@ +<% if(filters.bootstrap) { %> // Colors // -------------------------------------------------- @@ -34,4 +35,4 @@ .btn-google-plus { .button-variant(@btnText; @btnGooglePlusBackground; @btnGooglePlusBackgroundHighlight); -} \ No newline at end of file +}<% } %> \ No newline at end of file diff --git a/app/templates/client/app/account(auth)/login/login(sass).scss b/app/templates/client/app/account(auth)/login/login(sass).scss index 66ddb2aa8..bbfca2eb7 100644 --- a/app/templates/client/app/account(auth)/login/login(sass).scss +++ b/app/templates/client/app/account(auth)/login/login(sass).scss @@ -1,3 +1,4 @@ +<% if(filters.bootstrap) { %> // Colors // -------------------------------------------------- @@ -34,4 +35,4 @@ $btnGooglePlusBackgroundHighlight: #c53727; .btn-google-plus { @include button-variant($btnText, $btnGooglePlusBackground, $btnGooglePlusBackgroundHighlight); -} \ No newline at end of file +}<% } %> \ No newline at end of file diff --git a/app/templates/client/app/app(less).less b/app/templates/client/app/app(less).less index dc5c1a46f..d1e2d4ef8 100644 --- a/app/templates/client/app/app(less).less +++ b/app/templates/client/app/app(less).less @@ -1,7 +1,7 @@ -@import 'bootstrap/less/bootstrap.less'; +<% if(filters.bootstrap) { %>@import 'bootstrap/less/bootstrap.less';<% } %> @import 'font-awesome/less/font-awesome.less'; -@icon-font-path: '/bower_components/bootstrap/fonts/'; +<% if(filters.bootstrap) { %>@icon-font-path: '/bower_components/bootstrap/fonts/';<% } %> @fa-font-path: '/bower_components/font-awesome/fonts'; /** diff --git a/app/templates/client/app/app(sass).scss b/app/templates/client/app/app(sass).scss index b29935abc..fafe3d064 100644 --- a/app/templates/client/app/app(sass).scss +++ b/app/templates/client/app/app(sass).scss @@ -1,7 +1,7 @@ -$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/"; +<% if(filters.bootstrap) { %>$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";<% } %> $fa-font-path: "/bower_components/font-awesome/fonts"; - -@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap'; +<% if(filters.bootstrap) { %> +@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';<% } %> @import 'font-awesome/scss/font-awesome'; /** diff --git a/app/templates/karma.conf.js b/app/templates/karma.conf.js index 545fcf4bd..57b3fa6f2 100644 --- a/app/templates/karma.conf.js +++ b/app/templates/karma.conf.js @@ -17,8 +17,8 @@ module.exports = function(config) { 'client/bower_components/angular-resource/angular-resource.js', 'client/bower_components/angular-cookies/angular-cookies.js', 'client/bower_components/angular-sanitize/angular-sanitize.js', - 'client/bower_components/angular-route/angular-route.js', - 'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js', + 'client/bower_components/angular-route/angular-route.js',<% if(filters.uibootstrap) { %> + 'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',<% } %> 'client/bower_components/lodash/dist/lodash.compat.js',<% if(filters.socketio) { %> 'client/bower_components/angular-socket-io/socket.js',<% } %><% if(filters.uirouter) { %> 'client/bower_components/angular-ui-router/release/angular-ui-router.js',<% } %>