Proper way to customize Bower-installed components

假如想象 提交于 2019-12-12 11:16:03

问题


When I use Bower to install something like bootstrap-sass-official, it installs it in the bower_components directory. A component like Bootstrap allows for customization by editing the file bower_components/assets/stylesheets/_bootstrap.scss. In this case, you simple pick and choose which parts of Bootstrap you want to use for your project.

It is well known that it is most efficient and best practice to leave packages and components like ./bower_components, ./vendor, ./node_modules etc out of source control. But the problem with this is that when others download your source and install the bower dependencies, your customizations are never installed.

So, assuming that you are following best practices and keeping bower_components out of source control, where is the best place to customize a component like Bootstrap? Simply copy _bootstrap.scss to a source-controlled directory and customize it there? Or is there a more elegant approach?


回答1:


I believe you are correct in saying that the most elegant solution is to copy the _bootstrap.scss file to your project structure. You could then remove the bootstrap components that you wish to exclude, and modify the paths of the remaining components to point to your bower_components directory. In this way you get full customization over the library while only maintaining a single file.

This answer might also be helpful to those looking into this issue.



来源:https://stackoverflow.com/questions/30058758/proper-way-to-customize-bower-installed-components

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