How to get a non-timestamped version of the minified site CSS?

MatthewCongrove
Member

I'm using the HubSpot CMS and a marketplace theme for our company website. As part of this, HubSpot is generating a minified CSS file with all of the styles for the site. I'd like to include this stylesheet in a couple of non-HubSpot pages we have hosted elsewhere to keep styling in sync. Unfortunately, the CSS file generator is adding a timestamp into the URL, so I'm having to update our other, non-HubSpot pages to point to the new URL every time I change the CSS file.

 

Example current CSS file URL:

https://www.example.com/hs-fs/hub/123456/hub_generated/template_assets/123456/[TIMESTAMP]/Website/cs...

 

What'd I'd like to be able to use:

https://www.example.com/hs-fs/hub/123456/hub_generated/template_assets/123456/Website/css/main.min.c...

 

Does anyone know how to get a non-timestamped URL for this file?

0 Upvotes
4 Replies 4
Indra
Top Contributor | Diamond Partner

Hi @MatthewCongrove,

 

I'm not sure, but I think HubSpot uses the timestamp to update the styling for modules automatically. Therefor it's not possible to remove the timestamp from the URL. You can't add the CSS file like you requests externally since HubSpot is an closed source platform when using the design tools for creating the css.

 

So alternative options are:

  • Uploading your css file to the 'file manager' and embed that CSS file. This can be embedded to external sites. The path won't change.
  • Use your external platform to generate the CSS file and embed that file inside HubSpot.

Bureau Vet

Did my post solve your question? Help the community by marking it as a solution
MatthewCongrove
Member

I appreciate the response, but disagree with parts of your assessment, so hoping someone else can chime in here with another solution.

 

Using the generated stylesheet on an externally hosted page works just fine; the issue is that the cache-busting timestamp in the URL means I have to update the URL my page points to whenever any changes are made to the stylesheet.

0 Upvotes
Kevin-C
Recognized Expert

Hey @MatthewCongrove 

 

So the issue is that you want to run 2 sites on a single resource, but the resource was not designed to do this. This means your approach is unfortunately flawed. Not sayin it can't be done, just seems like the cost/benefit is out of whack!

 

A potential work around would be top use NODE & CLI tools to generate 2 stylesheets, and then pushes them to there required locations. One location is obviously the HS theme and the second could infact be HS file manager to take advantage of the static URL point made by @Indra . <- this approach would establish a single source of truth for your projects and use the HS CLI to watch/upload the files.

 

Just my take on the situation. Hope this helps ya out!

0 Upvotes
JJohn89
Member

I like the reaction, however can't help contradicting portions of your appraisal, so trusting another person can toll in here with another arrangement.

Utilizing the created template on a remotely facilitated page turns out great; the issue is that the reserve busting timestamp in the URL implies I need to refresh the URL my page focuses to at whatever point any progressions are made to the template.

0 Upvotes