0

We just upgraded a development site from Magento 2.1.X to 2.2.

I have a custom CSS file called in the default_head_blocks.xml of my specific theme (which had no issues working at all with 2.1.X). The file was called in like this...

<css src="css/tires-custom.css" after="-" />

After our upgrade to 2.2 it now gives the following error...

1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'css', attribute 'after': The attribute 'after' is not allowed. Line: 31

I changed nothing in the file but not get the error. I don't understand why it would cause an error simply due to the upgrade.

If I remove the attribute after="-" the site loads juts fine. The problem is I need to have my custom CSS loaded last.

Abhishek Panchal
4,9643 gold badges22 silver badges39 bronze badges
asked Oct 25, 2017 at 20:19

2 Answers 2

0

It's because vendor/magento/framework/View/Model/Layout/Merge.phps method _validateMergedLayout now throws an exception if the xml is invalid, but only in developer mode. You can either change your xml to match the xsd validation or ignore it and the error won't occur in production mode.

answered Jan 30, 2018 at 8:11
0

As far as I'm aware <css> does not support after="". To fix the error remove it.

answered Jan 30, 2018 at 10:30

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.