CMS Made Simple Forums
https://forum.cmsmadesimple.org/

[solved] caching css ressources: 404 error
https://forum.cmsmadesimple.org/viewtopic.php?f=89&t=76599
Page 1 of 1

Author:  Tomek [ Mon May 15, 2017 3:56 pm ]
Post subject:  [solved] caching css ressources: 404 error

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?

Author:  calguy1000 [ Mon May 15, 2017 4:03 pm ]
Post subject:  Re: caching css ressources: 404 error

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.

Author:  Tomek [ Mon May 15, 2017 4:15 pm ]
Post subject:  Re: caching css ressources: 404 error

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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/