Page 1 of 1

[solved] caching css ressources: 404 error

Posted: Mon May 15, 2017 3:56 pm
by Franck
When editing and saving a css file in assets/css, all its linked ressources (img, fonts…) are being added tmp/cache/ to their paths, leading to 404 errors.
Am I doing something wrong or is it a bug?

Re: caching css ressources: 404 error

Posted: Mon May 15, 2017 4:03 pm
by calguy1000
CSS files are stored in assets/css OR in the database but the {cms_styleseet} call generates a file in tmp/cache and that's what the HTML stylesheet tag uses. This part has not changed in CMSMS 2.2.

Therefore, if using relative paths in the CSS they would be relative to tmp/cache.

Best is to use absolute paths. [[root_url]]/assets/images/foo.jpg etc. or to use paths relative to the root. i.e: /assets/images/foo.jpg (whatever works)... but [[root_url]]/assets/images/foo.jpg is recommended as it will definately remove any relative path issues.

Re: caching css ressources: 404 error

Posted: Mon May 15, 2017 4:15 pm
by Franck
Oh yes, should have remembered this one. Actually, as I was using sass without {cms_stylesheet} for the last sites, I didn't have to use [[root_url]] in stylesheets anymore.
Now, I'm using sass with {cms_stylesheet} and the url parameter is a bit more complicated to find. Btw, I found it.

Thanks for the reply.