1

I have a custom page layout defined as lf_cms in layouts.xml file, and am trying to remove the css file as defined in default_head_blocks.xml and load a new CSS file, except the CSS changes are not loading.

What do I need to do to get changes to the CSS files to load on the page?

I know that the page layout is loading correctly because it's showing up in the admin section under the Design tab on a CMS page. In addition, if I make a syntax error, I get an exception when viewing the page.

I have also recompiled static assets, cleared caches, and removed var/view_preprocessed files.

Design section of the CMS page

[custom_theme]/Magento_Theme/layouts.xml

<?xml version="1.0" encoding="UTF-8"?>
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
    <layout id="lf_cms">
        <label translate="true">lf_cms Custom</label>
    </layout>
</page_layouts>

[custom_theme]/Magento_Theme/page_layout/lf_cms.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<update handle="1column"/>
    <head>
        <remove src="css/standardStyles.css" />
        <css src="css/customStyles.css" />
    </head>
</layout>

Any help or direction would be greatly appreciated.

Thank you!

0

Please run this command, hope this will help. php bin/magento setup:static-content:deploy -f.

  • Unfortunately that did not work :( – loganfarr Feb 27 at 0:27

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.