Skip to content

Commit

Permalink
feat(gen): make bootstrap and bootstrap ui optional
Browse files Browse the repository at this point in the history
  • Loading branch information
DaftMonk committed Jul 4, 2014
1 parent 1703916 commit f50d094
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
19 changes: 16 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
},

Expand Down Expand Up @@ -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";
},
Expand Down
8 changes: 4 additions & 4 deletions app/templates/_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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) { %>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% if(filters.bootstrap) { %>
// Colors
// --------------------------------------------------

Expand Down Expand Up @@ -34,4 +35,4 @@

.btn-google-plus {
.button-variant(@btnText; @btnGooglePlusBackground; @btnGooglePlusBackgroundHighlight);
}
}<% } %>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% if(filters.bootstrap) { %>
// Colors
// --------------------------------------------------

Expand Down Expand Up @@ -34,4 +35,4 @@ $btnGooglePlusBackgroundHighlight: #c53727;

.btn-google-plus {
@include button-variant($btnText, $btnGooglePlusBackground, $btnGooglePlusBackgroundHighlight);
}
}<% } %>
4 changes: 2 additions & 2 deletions app/templates/client/app/app(less).less
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down
6 changes: 3 additions & 3 deletions app/templates/client/app/app(sass).scss
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down
4 changes: 2 additions & 2 deletions app/templates/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',<% } %>
Expand Down

0 comments on commit f50d094

Please sign in to comment.