Skip to content

Commit

Permalink
Add bower.json overrides for bootstrap (#338)
Browse files Browse the repository at this point in the history
Revert commit ecf4928 (Lock Bootstrap to v3.3.4)

Add bower.json overrides for bootstrap (#338)

Add test for bootstrap's bower.json overrides
  • Loading branch information
jaromero committed Jun 23, 2015
1 parent 1841dca commit 196e745
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
23 changes: 20 additions & 3 deletions app/templates/_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@
"name": "<%= name %>",
"private": true,
"dependencies": {<% if (includeBootstrap) { if (includeSass) { %>
"bootstrap-sass": "3.3.4"<% } else { %>
"bootstrap": "3.3.4"<% }} else if (includeJQuery) { %>
"bootstrap-sass": "~3.3.1"<% } else { %>
"bootstrap": "~3.3.1"<% }} else if (includeJQuery) { %>
"jquery": "~2.1.1"<% } if (includeModernizr) { %>,
"modernizr": "~2.8.1" <% } %>
}
}<% if (includeBootstrap) { %>,
"overrides": {<% if (includeSass) { %>
"bootstrap-sass": {
"main": [
"assets/stylesheets/_bootstrap.scss",
"assets/fonts/bootstrap/*",
"assets/javascripts/bootstrap.js"
]
} <% } else { %>
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js",
"dist/fonts/*"
]
} <% } %>
} <% } %>
}
22 changes: 22 additions & 0 deletions test/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ describe('Bootstrap feature', function () {
it('should contain the font icon path variable', function () {
assert.fileContent('app/styles/main.scss', '$icon-font-path');
});

it('should correctly override bootstrap\'s bower.json', function() {
assert.fileContent('bower.json', '"overrides"');

assert.fileContent('bower.json', 'assets/stylesheets/_bootstrap.scss');

assert.fileContent('bower.json', 'assets/fonts/bootstrap/*');

assert.fileContent('bower.json', 'assets/javascripts/bootstrap.js');
});
});

describe('without Sass', function () {
Expand All @@ -85,5 +95,17 @@ describe('Bootstrap feature', function () {
it('should output the correct <script> paths', function () {
assert.fileContent('app/index.html', /src=\"(.*?)\/bootstrap\/js\//);
});

it('should correctly override bootstrap\'s bower.json', function() {
assert.fileContent('bower.json', '"overrides"');

assert.fileContent('bower.json', 'less/bootstrap.less');

assert.fileContent('bower.json', 'dist/css/bootstrap.css');

assert.fileContent('bower.json', 'dist/js/bootstrap.js');

assert.fileContent('bower.json', 'dist/fonts/*');
});
});
});

0 comments on commit 196e745

Please sign in to comment.