0

I have created a custom theme that extends Blank theme.This is my default_head_blocks.xml of custom-theme.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <css src="css/custom-style.css" />
</head>
</page>

I followed official document to change theme color so created _theme.less in source folder . Then I deleted var/view_preprocessed and pub/static/frontend & then executed this command :

php magento setup:static-content:deploy

Now am getting error on frontend for style-l.css,print.css,style-m.css though I have extended Blank theme.

While deployment , it gives message like Successful :1000files error : 38

2
  • If you develop theme you need enable developer mode and never call setup:static-content:deploy
    – KAndy
    Commented Jun 24, 2016 at 6:36
  • Yes I have enabled developer mode.I executed that command.Now am getting error all over the site.CAn you please help me out with this?what should I do now? Commented Jun 24, 2016 at 6:40

2 Answers 2

2

I just had this issue, too, and found that it is because of the order by which the css and less are compiled. You need to use the style.less file. Copy that from the blank theme and I noticed that the .css files were then auto generated with my custom css directory. However, any changes that would need to be made in the styles.less could mostly likely be made in the _theme.less. This is how I ultimately solved the issue. Within the _theme.less you can make specific css changes or make changes to variables like colors and such.

Here are a couple of examples:

*Overriding colors
@color-darkslateblue: #2d5986;
@color-bluehover: #426992;
@color-floralwhite: #f8f8ee;
@color-blue1: @color-darkslateblue;
@color-blue2: @color-bluehover;

/*customizations*/
.nav-sections {
  background: @color-darkslateblue;
}

enter image description here

0

I have had this issue too. I created a new theme with the parent theme "blank".

Every time I deployed static content the style-m.css would not compile and I would get an error in the command prompt.

It looks like some of the variables that are being requested in the style-m.less file have not be created in the "blank" theme.

The solution is to copy the variables from the "Luma" theme .less files and add them to the relevant "blank" theme .less files.

For example one error I received was

variable @mobile-cart-padding cannot be defined.

After searching google for the related .less file I found it to be

vendor/theme-frontend-luma/Magento_Checkout/web/css/source/module/_cart.less.

At the top of the file was the variable @mobile-cart-padding: 15px; . I then copied the variable to the same file within the blank theme.

Ta da. There might be multiple files but this should sort things out. Don't forget to remove the contents of the folders in the

  • var/cache
  • var/view_preprocessed
  • var/generation

before running each deploy static content command.

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.