This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

vladimir.camaj64790
vladimir.camaj64790

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

Codecycler
Codecycler

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.

vladimir.camaj64790
vladimir.camaj64790

Ok it works. But why it does not work without the [] parenthesis? Also where could I find the documentation to it?

Codecycler
Codecycler

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

Codecycler
Codecycler

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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.