Development Workflow - Bootstrap (Less), Bower and Grunt

别来无恙 提交于 2019-12-08 03:33:11

问题


I am trying to step up my game as far as my folder structure and workflow is considered. I have recently discovered that front end package management and automation of tasks are key to improve speed, decreasing dev time, decrease file size and increase profit.

My issue is I am not too sure what the best method of using these tools are. I have a builds folder, which includes a dev and prod folder. My components are outside this folder in the bower_components folder.

I usually customise bootstrap and take advantage of it's variables file and mixins. I have copied the bootstrap.less file, and the variables.less file, and placed them in builds->dev->less. I then have grunt compiling the less using the bootstrap.less file from this new directory.

Is this the best way to go about using bootstrap and it's less files in this setup? I want to use bower due to it's power, but I also want to keep the power of customising bootstrap and it's less files.

What do you guys think?

NB: I usually code themes for brochure websites and very small applications.


回答1:


As posted above by Bass Jobsen:

you don't have to copy bootstrap.less and variables.less. Less uses lazy loading and last declaration wins for variables, so to can put their definition afterwards to (re)assign them. Create a project.less file which @imports bootstrap.less from your bower folder and put your custom variables assignments, mixins, and code after the @import



来源:https://stackoverflow.com/questions/30071940/development-workflow-bootstrap-less-bower-and-grunt

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