2

I am creating a plugin in OctoberCMS and i need to use less for some front-end & back-end use cases. The problem is that i have no idea how to import less files files in my plugin.

As i understand it, normally something like this would be done:

<link href="{{ ['assets/less/theme.less']|theme }}" rel="stylesheet">

But for me this is not working. I would like to know what i'm doing wrong, or how it should be done. In an attempt to do this, the furthest i got was the following:

<link href="{{ ['path/to/plugin/asset.less']|app}}" rel="stylesheet">

Does anyone here know how i can use less in a plugin?

EDIT: i have done some more digging and found that if i register the less bundles in my plugin like so:

CombineAssets::registerCallback(function($combiner) {
        $combiner->registerBundle('~/path/to/style.less');
    });

and the compile it using the command line like so:

php artisan october:util compile less

and then import the css in the html, then it works.

If anyone knows how to do this realtime it would be awesome to hear it.

0 Answers0