1

I am having a problem with my custom theme in magento 2, for some reason the css I'm writing isn't showing up on the site.

I have created my custom theme at

app/design/frontend/Matt/New/ 

it's parent is the blank theme and I am able to apply the theme with no errors. I have created a less file at

web/css/source/style.less 

the contents of the file is

#maincontent{
 background-color: blue;
}

I can run "grunt exec:New" and that works without any errors. I can then deploy with no errors. If I then restart xampp and reload the site the style is not applied. I have checked the source by pressing "ctrl + u" and I can see that the style.less file is there under

<link href="http://test.dev/pub/static/version1484246990/frontend/Matt/New/en_GB/css/source/style.less" />

The styles are not in the either of the files styles-m.css or styles-l.css though. I have tried clearing cache, deleting pub/static. I'm not sure what else to do or what the problem could be, does anyone have any possible solutions?

asked Jan 12, 2017 at 19:11

1 Answer 1

1

From my understanding there are only two files that get automatically picked up and pulled into the styles-m.css and styles-l.css files from your theme:

_extend.less

and

_theme.less

The _theme.less file will override the same file in the parent theme, were as the _extend.less will just be added onto the other files. Try changing that and see if your styles show up.

answered Jan 12, 2017 at 19:39
2
  • 2
    Thanks so much, that worked. I don't know how I didn't noticed that in the documentation! Commented Jan 12, 2017 at 19:50
  • sweet, glad it worked! Commented Jan 12, 2017 at 19:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.