CMS Development

ACambium
Member

Help Needed: get_asset_url "no resource" & JS Minification Error in Custom Theme

SOLVE

I'm working on creating a custom theme page and I'm running into some persistent issues with linking my CSS and JavaScript assets. I've been through a number of troubleshooting steps, and also worked with HubSpot Support, but I'm still stuck.

My Theme Structure: My theme ("Sample Theme") has the following structure at its root:

  • css/
    • sample.css
    • test-styles.css (created for debugging)
    • js/
      • sample-one.js
      • theme.json
      • fields.json
      • sample-page.html (my page template)

 

 

Error Messages: When I use my sample-page.html template on a page, I'm seeing these errors in the Design Manager validator:

get_asset_url was called, but there is no resource at path css/sample.css (and a similar one for css/test-styles.css when I was testing that).

 

Previously, I was getting an error like ...path null/css/... but that null part seems to have resolved after ensuring the page was created correctly under the active theme. The theme.path debug code now shows a valid path.

When using the full template, the links are: <link rel="stylesheet" href="{{ get_asset_url('css/sample.css') }}"> <script src="{{ get_asset_url('js/sample-one.js') }}"></script>

 

Troubleshooting Steps Taken

CSS "No Resource" Error (even for test-styles.css):

  • Confirmed the theme ("ZIP Code Insights Theme" and a clone "ZIP Insights Theme Clone") is active for the domain.
  • Ensured sample-page.html, css/test-styles.css, css/sample.css, and js/sample-one.js are all published (green dots).
  • Verified exact filenames, folder names (all lowercase for css and js), and their locations directly under the theme root.
  • When creating a test page, I explicitly select the correct theme first, then the sample.html template from that theme.
  • The theme.path debug code does show a valid path on the rendered page (e.g., Sample Theme or Sample Theme Clone).
  • Tried recreating css/test-styles.css from scratch (delete, new file, paste simple CSS, publish).
  • The "no resource at path css/test-styles.css" error remains even when theme.path is correctly outputting the theme name.
  • Tried cloning the entire theme and repeating all tests within the cloned theme – the same errors occur.

    My Questions:

    1. Regarding the CSS get_asset_url "no resource" error: If theme.path is correctly identified on the rendered page, and the file css/test-styles.css definitely exists, is published, and is named correctly within the theme's css folder, why would HubSpot still report "no resource at path css/test-styles.css"? 

      I'm at a bit of a loss as to what to try next, especially since the null path issue seems resolved but the files still aren't found. Any advice or insights would be greatly appreciated!

0 Upvotes
1 Accepted solution
MichaelMa
Solution
Contributor

Help Needed: get_asset_url "no resource" & JS Minification Error in Custom Theme

SOLVE

As far as I'm aware, get_asset_url will traverse from it's current location (aka the template) to the file.

 

Since the template file is in /css/js, this is our current location.

 

This means that:

get_asset_url('css/sample.css')

 

Tells it to find the folder CSS in the CURRENT directory and find the file sample.css or in other words: /css/js/css/sample.css.

 

You need to go downward by adding a ../ to the front to reach the appropiate folder aka 

get_asset_url('../sample.css') = /css/sample.css = go down one folder and find sample.css

 

Or if you want to be super specific:

get_asset_url('../../css/sample.css') = /css/sample.css = go down two folders (current folder is js folder -> css folder -> root), find CSS folder and find sample.css.

 

 

 

View solution in original post

2 Replies 2
MichaelMa
Solution
Contributor

Help Needed: get_asset_url "no resource" & JS Minification Error in Custom Theme

SOLVE

As far as I'm aware, get_asset_url will traverse from it's current location (aka the template) to the file.

 

Since the template file is in /css/js, this is our current location.

 

This means that:

get_asset_url('css/sample.css')

 

Tells it to find the folder CSS in the CURRENT directory and find the file sample.css or in other words: /css/js/css/sample.css.

 

You need to go downward by adding a ../ to the front to reach the appropiate folder aka 

get_asset_url('../sample.css') = /css/sample.css = go down one folder and find sample.css

 

Or if you want to be super specific:

get_asset_url('../../css/sample.css') = /css/sample.css = go down two folders (current folder is js folder -> css folder -> root), find CSS folder and find sample.css.

 

 

 

DianaGomez
Community Manager
Community Manager

Help Needed: get_asset_url "no resource" & JS Minification Error in Custom Theme

SOLVE

Hi @ACambium,

 

Thanks for reaching out to the Community!

 

I would like to invite some members of our community who may offer valuable insights.— hey @SteveHTM, @BarryGrennan,@Kevin-C  - Could you share your advice with @ACambium?

 

Thanks for taking a look!

Diana


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuarciones!
0 Upvotes