I'm trying to figure out how I can package a module with some .less files in it through composer.

For example, let's say You wrote a module which has few frontend parts, of course this parts needs some basic styles, a less file.

According to the official documentation, less files must not be placed into the module dir, so You should put them in the theme directory.

So, You would create a Vendor_Component/web/css/source/_module.less file into the blank theme dir and place your styles there (in order to use the fallback system for child themes)

Now, that everything is ready, how do You handle the composer.json (and registration.php)? It's not completly a module and not either a theme...

I was thinking about a Metapackage, splitting the theme part from the module but I have some doubts about it, for example about how to place the Vendor_Component dir into the blank theme.

So the question is, how do You package it?

1 Answer 1


"According to the official documentation, less files must not be placed into the module dir" -- could you, please, point to the documentation page where it's said? It might be possible to put LESS files in a module, under view/<area>/web/css. So you should not need additional theme for it. Also FYI: Alan Kent has just released his 2nd book about Magento 2 -- "Theme Web Page Assets", see http://alankent.me/gsd/the-getting-stuff-done-in-magento-2-e-book-series/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.