Disable Cache for Specific Coded Files


The Setup

We are in the process of building out a new theme for a client in the COS. Our CSS is included via a {{ include_css(...) }} Hubl tag.

The Issue

As we are continuously testing and tweaking our CSS to integrate better with native hubspot styles, we need our file to avoid caching while in development. One option is to automagically rev our CSS file, but then we need to update the reference after every deploy (and we deploy about 30 times a day).

We found it fairly difficult to uncache the CSS file through generic means of adding a ?v=2342 or the like as these still resulted in the app.min.css cached file being served up.

The Ideal Solution

A list of files for the cache to ignore would be absolutely brilliant! :heart_eyes:


Hi @dillonbailey,

There’s no built-in way to disable caching for specific files. You’d need to implement some automated solution that added a unique query parameter (like a timestamp) to the end of the CSS file path.

On an unrelated note, the include_csss() function is being deprecated. You should instead use require_css():


Additionally, if you can reproduce the issue, please let us know. Caches should be cleared within a few seconds of any content or css file changing, so manual cache clearing should not be necessary.


@Derek_Gervais so I tried to use require_css() and it broke - is that implemented globally?

Looks like according to the doc referenced we need a complete URL - how do we get that from coded files when it generates {{ get_public_template_url("custom/system/jumbla_honestfox_theme/app-6cea8ff4e7.css") }} for public URL?


@boulter cheers mate - it was easy to replicate at the time, but for right now it’s probably something we’ll move past and just keep revving our files until stable. Will let you know.


Hi @dillonbailey,

You can use the get_public_template_url() function inside of the require_css() function, like this:
{{ require_css(get_public_template_url("/custom/system/jumbla_honestfox_theme/app-6cea8ff4e7.css")) }}


@Derek_Gervais Roger that! Cheers.

I’d recommend updating the docs with a similar example as that’s going to be a common use case and showing it only referencing a full external URL made me think that was a requirement. :+1:


Hi @dillonbailey,

Thank you for the feedback, I’ll work on getting those docs updated. :+1: