This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have a new file /custom/navbar.less included in main theme.less file via @import "custom/navbar";
But I am not able to compile it to css. I cant find any documentation about it. I tried to run npm run compile-less
but it did not include my new file to result css. Everything I found is more than 4 years old.
How can I do it?
Last updated
Hi Vladimir. Do you mean the CSS in a theme? You can easily add the less file by adding this to your layout or page.
<link rel="stylesheet" href="{{ ['assets/custom/navbar.less']|theme }}">
It will be compiled on request. You don't need to manually compile the file.
Ok it works. But why it does not work without the [] parenthesis? Also where could I find the documentation to it?
Hi Vladimir, I'm glad it works now! October CMS has a great feature called combiner which compiles assets. It can be used to auto compile Less and Sass. You can also automatically minify the assets. It's really cool! You should use the brackets as they tell the CMS controller to compile.
Here you can find a bit more about developing themes with combiner: https://octobercms.com/docs/themes/development#combiner-vars
Last updated
vladimir.camaj64790 said:
Ok it works. But why it does not work without the [] parenthesis? Also where could I find the documentation to it?
This link has some better documentation about combiner: https://octobercms.com/docs/markup/filter-theme
1-5 of 5