Johannes Klauß
Johannes Klauß

Reputation: 11040

compile LESS with custom parameters using Assetic

I want to compile a LESS file with parameters fetched from the database.

So something like this:

$color = "#433332";

And then in .less

@baseColor: $color;

Of course this is just pseudocode, so give you an idea what I want to do.

I am using Assetic, Symfony 2.1.8-DEV and the leafo/lessphp bundle.

I have no idea how I could achieve this. Is it even possible?

Upvotes: 1

Views: 798

Answers (1)

Steve
Steve

Reputation: 5853

You could possibly define a parameter at runtime based on a db value and pass it into your assetic configuration and through to LESS as a global var (or similar), but configuration is parsed pretty early on and that would probably be a bit mental. I certainly wouldn't rule it out as possible though, I'm pretty sure I've seen a hack to achieve this using the regular SASS compiler.

The following PR on GitHub may be of relevance:

https://github.com/kriswallsmith/assetic/pull/177

Upvotes: 1

Related Questions