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

How to write a less-to-less transformer? #3132

Closed
rulatir opened this issue Nov 24, 2017 · 2 comments
Closed

How to write a less-to-less transformer? #3132

rulatir opened this issue Nov 24, 2017 · 2 comments
Labels

Comments

@rulatir
Copy link

rulatir commented Nov 24, 2017

I need to write a less-to-less transformer to recursively inline all locally resolvable @imports. Can this be done as a plugin, or must I fork less.js?

I am trying to implement fast in-browser preview powered by modifyVars() without refactoring a huge LESS codebase that was originally developed for command line compilation and uses custom file managers that can't be easily implemented in browser.

@seven-phases-max
Copy link
Member

seven-phases-max commented Nov 24, 2017

It's possible with a plugin but that would be very suboptimal and dramatically tedious. The problem is that you'll have to render the internal AST format back to Less code and there's nothing in the compiler code-base to help you with that (the compiler is built around AST->CSS conversion only).
It would be much easier if you simply parse your input files for imports with some regexs and perform basic string-based substitutions.

@seven-phases-max
Copy link
Member

Closing in favour of #2428 (see my comment there too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants