@asset: Hashes

After running build:production the path returned by @asset for an image file is incorrect (404) because the file names got a hash postfixed.
How can I get @asset working even with build:production (e.g. for deploy to production)?

Thanks!

It already does. If it’s not working for you, have you changed anything in the core functions of sage?

1 Like

The core of sage should be the same. I have to further debug. :crying_cat_face:

@Nicolo_Sacchi: Must all assets used with @asset be added to config.json?

So I investigated more and found out that the reason was an absolute path:

Using an absolute path results in a valid path in dev build - but not in a build:production build:

@asset('/images/test.jpg')

Using a relative path works in both, dev build and build:production build:

@asset('images/test.jpg')

Although the absolute path is arguably wrong, it would be still a good addition if sage9 either warns because of it or @asset doesn’t work consistently in both cases (dev and build:production builds).

1 Like