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
less.render is not working with @import files which are in different directories in nodejs #2342
Comments
Note that since the source is supplied to the compiler as a string you need to explicitly set the original file path so the compiler can use it as the base one for imports and so, otherwise it just can't know what are all those paths you specify are relative to (most likely it will use just
The same goes for the |
Thanks seven-phases-max. This solution is working fine hence closing the issue. |
I have used LESS to implement theming in my application and using nodejs less module to compiling less files to CSS but its not working in one particular scenario.
I am also using Bootstrap for my application and using Bootstrap less source code I am compiling only that css which I want in my application.
I can also override Bootstrap variables and mixins in my various themes. So, while compiling Bootstrap I need to consider particular theme variables and mixins as well.
So, differentiate Bootstrap variables/mixins and CSS rules I have created 2 different files,
Directory structure For the application
Explanation of which file contains what?
1. /sample_application/themes/<-theme_name->/mixins/mixins.less
This file contains all application specific mixins and overridden bootstrap mixins.
2. /sample_application/themes/<-theme_name->/variables/variables.less
This file contains all application specific variables and overridden bootstrap variables.
3. /sample_application/themes/<-theme_name->/<-theme_name->.less
This file contains file imports of mixins and variables for that particular theme.
4. /sample_application/themes/theme.less
This file contains two file imports. First one for Bootstrap variables which is application_variables.less and second one for particular themes' base file imports for eg. red.less/blue.less
5. /sample_application/resources/libraries/bootstrap/css/application.less
This file contains one file import which is /themes/themes.less and all required Bootstrap CSS Rules.
6. /sample_application/resources/libraries/bootstrap/less/application_variables.less
This file contains all required Bootstrap variables and mixins.
Now I have one node script file which dose the bootstrap less compilation which is compile-bootstrap.js
But when I run this script I am getting following error
Then I tried using relative paths as well but still its giving the same error
The text was updated successfully, but these errors were encountered: