Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow modifyVars callback #1957

Closed
DaleyKD opened this issue Apr 7, 2014 · 2 comments
Closed

Allow modifyVars callback #1957

DaleyKD opened this issue Apr 7, 2014 · 2 comments

Comments

@DaleyKD
Copy link

DaleyKD commented Apr 7, 2014

I have a true need to 'intercept' the created CSS generated by LESS js. In 1.5.0, I was able to overload loadStyleSheets and return root.toCSS(less) for my purposes.

However, in 1.6.0 and greater, the minifier was changed, and loadStyleSheets doesn't retain its function name. Therefore, I can't find a way to get the CSS that was generated.

I thought I could just obtain it from the head, but IE does a nasty transposition to the set CSS, not allowing me to get the pure LESS-generated CSS.

Am I missing something, or is this an enhancement request?

For now, I've reverted to 1.5.0, and life is peachy.

Thanks in advance,
Kyle

@lukeapage
Copy link
Member

There is a postProcessor option
https://github.com/less/less.js/pull/1842/files

@DaleyKD
Copy link
Author

DaleyKD commented Apr 11, 2014

That, sir, is EXACTLY what I needed. I didn't realize it was a new feature. Glad to have it.

I have implemented it in my solution, and it works perfectly.

I'm not sure if documentation has been updated, but if anyone sees this thread, be sure that in your callback function, you return the style so LESS can continue. In my case, I just copied it to a local variable and then "return styles;".

@DaleyKD DaleyKD closed this as completed Apr 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants