Question

I have created my own theme, extending Magento/blank. In my own theme, I have included bootstrap among others, and removed the less files from the default theme (I'm not using stles-l.css or styles-m.css).

In some _module.less files from various modules I have created, I'm using bootstrap's vars.

Everything works fine when I do a static-content:deploy for my own theme.

However, if I do a static-content:deploy for the blank theme, errors are generated, because the custom vars specific to my own theme are not defined. Which is normal.

Maybe I'm too lazy to figure it out myself, but has anyone had this sort of issue?

I don't need to use the blank theme at all, but sometimes I need to change between deploy modes (deploy:mode:set), and then, this happens:

Something went wrong while deploying static content. See the error log for details. Command returned non-zero exit code:

/usr/bin/php7.0 -f /public/bin/magento setup:static-content:deploy fr_FR en_US

The deploy command is run as it is, without a -t param, and generates a mess.

I could change the deploy mode without using cli, but this is not my question.

Cheers! :)

Was it helpful?

Solution

I found one way of achieving my purpose.

Instead of using the default "_module.less" naming for module specific files, I'm using a different naming convention - "_mytheme.less", placed in the same path: web/css/source/ (either in a custom module view/frontend/ folder or in a rewrite of a module form my theme - design/frontend/Namespace/Theme/Module_Name/web/).

Then, in my theme's main less file, I added the special import line:

//@magento_import 'source/_mytheme.less';

All _mytheme.less files from my custom modules or module rewrites are compiled this way (this is the same way _module.less files are imported). The "downside" is that they will only show up in my custom theme, but this doesn't affect me :)

Hope it helps somebody.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top