I am using grunt/M2 & I noticed my less files are loading before my css files in my Magento 2 website. Any ideas? I need the less file to load last so it overwrites classes.

Here is what's in my theme/layout/default_head_blocks.xml:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
<css src="css/local-m.css" />
<css src="css/local-l.css" media="screen and (min-width: 768px)"/>
<css src="css/source/_custom.css" /> <!-- This is the less file -->

There is an extension available that will let you pass an order when adding your custom CSS file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.