Plugin images inaccessable

(Thomas Smyth) #1

This is an odd situation.

On Dec 19, 2013 this comment was made in lib/tasks/assets.rake:

# in the past we applied a patch that removed asset postfixes, but it is terrible practice
# leaving very complicated build issues

It turns out my plugin relies on non-digested images since they are used in my templates as src’s.

Why am I only asking this now? Because I think on my production box there were old copies of non-digested assets lying around from pre-Dec 19. I only just now deleted them for an unrelated reason, and the problem suddenly emerged.

What should I do? Avoid using img src? Is there some way to get handlebars to add the digest? Should I use all background-image? It appears that my plugin asset paths are not digested in the compiled CSS file either.

Help? Thanks.

(Sam Saffron) #2

Interesting issue, digesting the images is the correct thing to do, otherwise you have to around renaming every image when you update.

Getting the correct url should be fairly easy server side, client side its a bit of a nightmare though cause you would have to ship it down.

I guess we can add an additional location for undigested images. We plan to work on extensibility for the next release so will make sure we address this.

(Thomas Smyth) #3

Thanks for the quick reply.

Is this not an issue for the main Discourse handlebars templates because it doesn’t use hardly any images?

Or are they all in stylesheets? If that’s the solution then how come paths in my plugin stylesheets aren’t getting digested?

(Sam Saffron) #4

Images usually come from CSS, have a look there is an asset-path helper thing you can use.

You just need to make sure you use the helper.

(Thomas Smyth) #5

Thanks Sam. This is a big help. I will refactor!