Jared
Jared

Reputation: 6090

Programmatic LESS imports

Is there any way to tell less to import different external files based on something pragmatically?

I process my LESS with dotless, but can't find anything that hints towards this being possible.

EDIT: Also just so this info is available. I'm aware of how to import specific files into another file. My question is the ability to specify a file to import based on some other piece of data....the users role...status of something....etc.

Upvotes: 0

Views: 209

Answers (1)

ScottS
ScottS

Reputation: 72281

Is there a reason you cannot just do something this, while generating your LESS file with ASP:

If userRole1 Then     

  code to load imports for userRole1   

Else    

  code to load default imports

End If

In other words, generate your LESS file with ASP, accessing what you need, then have it output the LESS code with the desired imports, then LESS takes over to build the CSS.

Upvotes: 1

Related Questions