0

I am using Magento 2 (developer mode) and I just created a new theme, added a local-l.css to my /var/www/vendor/app/design/frontend/vendor/theme/web/css/source/local-l.css and when I refresh the homepage it says

404 GET http://www.vendor.dev/pub/static/version1486248173/frontend/vendor/theme/en_US/css/local-l.css

app/design/frontend/vendor/theme/Magento_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">
<head>
    <css src="css/local-l.css" />
</head>
</page>

And doesn't load my styles.. I tried clearing cache, view_preprocessed, pub/static/*, everything and I tried redeploying using static:mode:deploy... nothing is working for me.

Any ideas?

  • Seem that your custom css puts wrong place, it should be under web/css folder : app/design/frontend/vendor/theme/web/css/local-l.css – Khoa TruongDinh Feb 5 '17 at 1:48
1

Seem that your custom css put wrong place, it should be under web/css folder in your custom theme : app/design/frontend/vendor/theme/web/css/local-l.css.

Remember to run static content deploy again.

4

You have "Sign Static Files" options set to Yes in your backend : http://docs.magento.com/m2/ce/user_guide/system/static-file-signature.html

Magento 2 add versionXXXXXXX to his URL to avoid "extrem" browser caching.
Browser cache URLs with versionXXXXXXX in it so when there is a new release of static content Magento set URLs to versionYYYY to force content cache to be renewed.

For comparison is like ?version=XXXX for Wordpress files.

You have 2 solutions :
1. Set Sign Static Files option to No
2. Add this line to you host configuration (here NGINX) : https://github.com/magento/magento2/blob/develop/nginx.conf.sample#L101

location /static/ {
    # Remove signature of the static files that is used to overcome the browser cache
    location ~ ^/static/version {
        rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
    }
}
  • Thankyou!!!!! <3 – Kara Feb 6 '17 at 14:35

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.