Use the Bootstrap config.json file with Bower

試著忘記壹切 提交于 2019-12-05 19:07:21

问题


I used the Bootstrap customizer tool: http://getbootstrap.com/customize/ It generates a config.json file that I reuse whenever I need to make changes.

I use Bower to handle all my dependencies, except Bootstrap, because I need my customized version.

Is there a way I can tell Bower to use my config.json file to generate the CSS?

The chosen answer to this question seems to state that it is actually possible, but it doesn't give much details and I couldn't find anything else about that anywhere: Twitter Bootstraps config.json - what does it do?

I also found this package that lets you customize Bootstrap using your own LESS files, but that's not what I did, and it doesn't seem to use the config.json file: https://www.npmjs.org/package/grunt-customize-bootstrap

Thanks!


回答1:


You can use bower to install bootstrap-sass-official or the less version if you want and as stated here https://github.com/twbs/bootstrap-sass#sass

You can import bootstrap-custom and comment out the components that you don't need.

I had the same issue like you, this is what my bootstrap-custom.scss file looks like

@import "bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/variables";
@import "bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/mixins";
...
@import "bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/responsive-utilities";

And in my default.scss file i've put

@import "bootstrap";

And then compile!

Ps: i wanted to point out the link in a comment but need 50 reputation point :(



来源:https://stackoverflow.com/questions/24354163/use-the-bootstrap-config-json-file-with-bower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!