Gruff Bunny
Gruff Bunny

Reputation: 27986

Using LESS for custom styling

The current project that I'm working on has a requirement that some customers require their own styling (colours, fonts etc). Other customers will use the default styling lovingly crafted by our designer.

I was drawn to using something like LESS so that we would have a different variables file per customer and import that file into every css/less stylesheet where it's needed. The variables files would reside in a different folder for each customer.

The problem I have is how to import/reference the custom varaiables less file into the other stylesheets.

It's an asp.net web site (not MVC).

Upvotes: 1

Views: 265

Answers (1)

Gruff Bunny
Gruff Bunny

Reputation: 27986

Wrote an MSBuild target to compile all the LESS files for each of the different customers using the dotless compiler. The target uses the FileUpdate task from MSBuildTasks to amend the variables Import statement in each LESS file prior to the compilation task e.g @import '/css/default/variables.less' is changed to '/css/customer1/variables.less' etc.

Upvotes: 2

Related Questions