0

probably missing something simple here, but I can not get my css to load after adding it to new child theme

Here is my folder structure

enter image description here

I have added the following into my /layout/default_head_blocks.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <css src="css/styles-m.css" />
    <css src="css/custom.css" media="screen and (min-width: 768px)"/>
    <css src="css/print.css" media="print" />
</head>

And the header in my sit has changed and is referencing the files in the tag as expected

<title>Home page</title>
<link  rel="stylesheet" type="text/css"  media="all" href="http://dev.modzinc.co.uk/pub/static/version1487891140/frontend/Modzinc/basic/en_GB/mage/calendar.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://dev.modzinc.co.uk/pub/static/version1487891140/frontend/Modzinc/basic/en_GB/css/styles-m.css" />
<link  rel="stylesheet" type="text/css"  media="screen and (min-width: 768px)" href="http://dev.modzinc.co.uk/pub/static/version1487891140/frontend/Modzinc/basic/en_GB/css/styles-l.css" />
<link  rel="stylesheet" type="text/css"  media="screen and (min-width: 768px)" href="http://dev.modzinc.co.uk/pub/static/version1487891140/frontend/Modzinc/basic/en_GB/css/custom.css" />

put when I open the url : http://dev.modzinc.co.uk/pub/static/version1487891140/frontend/Modzinc/basic/en_GB/css/custom.css

I get this error

Unable to resolve the source file for 'frontend/Modzinc/basic/en_GB/css/custom.css'
#0    /home/ubodoco/public_html/dev/vendor/magento/framework/App/StaticResource.php(97): Magento\Framework\View\Asset\File->getSourceFile()
#1 /home/ubodoco/public_html/dev/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\StaticResource->launch()
#2 /home/ubodoco/public_html/dev/pub/static.php(13): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\StaticResource))
#3 {main}

Through the command line I have tried setup:upgrade , Cache:clean , cache:flush and nothing will make it work ??

Any ideas on what I am doing wrong

thanks

  • Forgot to say I am on magento CE 2.14 thanks – Barry Connolly Feb 23 '17 at 23:19
0

Have you run php bin/magento setup:static-content:deploy? All of your theme assets need to be compiled into the pub/static/ folders, so check the path is is giving you an error:

pub/static/frontend/Modzinc/basic/en_GB/css/custom.css

and see if your .css file is in there. If it's not, run the setup command above.

0

Looks like the static files are trying to get a specific version in there.

Building on what @circlesix said...

Clear out your pub/static/frontend and var/view_preprocessed folders, clear your cache and run php bin/magento setup:static-content:deploy en_GB from your root directory again

This should clear the version and your CSS file should start working.

Double check the file exists in

 pub/static/frontend/Modzinc/basic/en_GB/css/custom.css

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.