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.

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.

0

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

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.