Less partials


Hello, i would like to write my less file in partials, ex partials/header.less (i don't know if i have to prefix with _ like in scss which i am more used too). And in style.less

@import "partials/header.less";

Then i have beans_compiler_add_fragment( 'uikit', CHILD_URL . '/assets/less/style.less', 'less' ); But the import doesn't work here. Do i need to enqueue each partial as fragment ?



I already do that, but that is for uikit components. Then i have the additional style.less file, which is enqueued like that :

beans_compiler_add_fragment( 'uikit', CHILD_URL . '/assets/less/style.less', 'less' );

But, i would like to separate this file in partials, like i usually do with scss header, footer, nav etc... But it doesn't work like that here


I think that also work with a directory with other styles in it:

beans_uikit_enqueue_theme( 'uikit', get_stylesheet_directory_uri() . '/assets/less/partials/' );

Or:

beans_compiler_add_fragment( 'uikit', CHILD_URL . '/assets/less/partials/header.less', 'less' );

Hi guys,

Please refer to this reply. Beans currently used the lessphp library (only library used in Beans) which is the source of the issue. We are working on changing that and use the official Less.js library in the next release to make the best out of LESS and also sort this issue.

In the mean time, use beans_compiler_add_fragment() as explained in the reply mentioned above.

Thanks,


Thank you ! So i will enqueue them trough php. I knew that import was not good to import for ex google fonts, and i always enqueue them, but with sass i always import all the partials in style.scss so i didnt' know it wasn't so good.


Hi Thierry,

Can you explain a bit more about this please?

We are working on changing that and use the official Less.js library in the next release to make the best out of LESS and also sort this issue.

In the mean time, use beans_compiler_add_fragment() as explained in the reply mentioned above.

Does this mean that if we use beans_compiler_add_fragment() now, but then you change to the official Less.js library, that we will need to change what we wrote in the mean time?

Or does it mean that if people want to use @import in future then they will be able to do so after you have fixed it (even if it is slow), and the people who have enqueued the fragments as per the recommended method won't need to change anything?


Hey Guy,

It means that after updating to use a LESS processor which supports LESS @import users will have the choice to use @import or beans_compiler_add_fragment() but nothing will break. Backwards compatibility is taken very seriously in Beans and it is rare (if not never) that something you have already built breaks when updating to a newer version.

When backwards compatibility is affected (usually very minor things) it is always marked as important in the changelog so that every users are aware of it and can make the necessary modification if something they built is affected.

Always take a look at the changelog before updating which is good practice for any software πŸ˜‰

Have fun,


Thanks Thierry, I thought that's what you meant, but you know me, I'm fussy about the details πŸ˜‰

I read changelogs and take backups religiously, it's while learning something new that I use a magnifyng glass..

The more I understand about how Beans works, the more curious and interested I am becoming, it really is amazing.

What did I say to someone last night... Beans is like Sage on steroids!!

Write a reply

Login or register to write a reply, it's free!