I’m working on some works right now with a small team at the office. We decided to use Bootstrap as the front-end development framework. We came up with this solution for some key reasons:
- We need to do it fast.
- It’s easy to maintain, especially for a collaborative project
- Bootstrap is cool.
There are lots of similar frameworks to choose like Skeleton, 960.gs, Blueprint, Foundation, and more. It didn’t take long discussion to take Bootstrap. Its features and flexibilities are just perfect for our need. The next thing is that we need to do some customisations, for example on the font sizes and colours. Since Bootstrap might release updates in the future, it’s better to leave the core files untouched.
Basically, it’s easy to customise them by using its own customisation tool. But, I prefer another method by using LESS. And yes, Bootstrap works great with LESS. The installation works straight forward. After downloading
less.js file, add these two lines in the
<link rel="stylesheet/less" href="/path/to/bootstrap.less">
bootstrap.less file, there is a little note that we can easily modify the font color and size by working on the variables.less file. I decided not to edit it. I created another
.less file — for example:
mycustom.less — and import it from
bootstrap.less file. So, my
bootstrap.less file looks like this:
// My Custom LESS
And, this is what I have for
It should just work. But, does it work as expected? No.
Editing and saving
mycustom.less file, and refreshing my page does not load the latest variables. It takes time to refresh/load the latest changes. It’s not good. It happens because
less.js caches the
.less files called using
I tried to modify the web server setting by adding these lines in my
Header set Cache-Control "no-cache"
But, it didn’t work. After searching for solutions, there is a method offered for this issue. I added this line of code:
Now, whenever I make some changes on my .less files, reloading the page will give the latest changes. It works.