Hey,
I have a question with Sage 9 regarding the cache busting feature in production mode: how do you reference an asset from a JS module?
I have this (simplified) module for instance:
import $ from 'jquery'
import Mustache from 'mustache'
import Twitter from 'twitter-text'
import 'slick-carousel'
const $slider = $('#tweetsSlider')
const template = $('#tweet-template').html()
function init() {
$.get('<URL>', appendSlides)
}
function appendSlides(data) {
$.each(data.posts, function(i, post) {
const html = Mustache.render(template, {
url: post.url,
image: post.image ? post.image : window.themeconfig.asset_path + 'images/twitter-no-image.png',
user_url: post.user_url,
text: Twitter.autoLink(post.text),
})
$slider.append(html)
})
$slider.slick()
}
export default { init }
In this case i’m referencing the twitter-no-image.png
asset (a fallback image) directly in JS but then it won’t be replaced with the suffixed production asset when compiling.
Any idea how to get this right?
thanks for helping!