Example.css


(Andrew Harris) #1

Here's a fun one.

 

Lets say we have a CSS parse file of asset ID#1001 named mysite.css.

We want it to load real fast, so we turn Use Static Cache File? on.

Matrix creates a nice data URL, increments the ID to 1002, but doesn't create an actual asset that can be found in the asset map, instead creating confused maintainers who don't know what file to edit.

Not only that, but this shadowy CSS file is now known as 'example.css', further obscuring the relationship between it and the actual file it's based on. I mean, why not mysite.static.css?

 

Does this strike anyone else as odd?

Is it only me?


(Bart Banda) #2

The static css file is linked directly under the CSS parse file asset as a type 3 link, which is why you can't see it. Matrix generates this static file so that it can be cached in the browser, as the dynamic css parse file needs to get rendered and translate any mysource_files/ links to proper urls. However, you don't actually need to serve the static cache file to cache it. You can still send cacheable headers with the design file without turning on static caching, just like you would with a page asset. 

 

The main difference to the static file, is that it will send not-modified headers in its response. Meaning that even if the cache has expired in your browser, it will not load a new version from the server unless this date has changed. 

 

If the name of your static file is example.css, its probably because the original name of the design asset was that name as well. You can always change the name manually by going to the details screen of the static file and changing it there, as its basically just a file asset. 

 

Hope that helps. 


(Andrew Harris) #3

Hmm - OK, thanks!

 

It's a funny one though - the example.css name is not any of our doing as far as I'm aware - several files have all ended up with the same name.

Changing the name will help a little, but the main problem users are finding is just how to edit the asset - they don't realise it's based on the design asset, can't find it, get confused, place a support request, etc…

 

Type 3 Link eh? Had to look that one up! ;-)