Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing asset in javascript

The Ember CLI guide describes how assets can be referenced in the templates and the CSS - but what is the proper way of referencing an asset (say an image) from my javascript code?

Specifically I am concerned about the asset path getting fingerprinted correctly when building assets for production. It seems like ember-cli is using broccoli-asset-rev for this, but according to its documentation, only <script> tags in the HTML and url() in CSS will be fingerprinted. Is there any way (probably through another broccoli plugin) to get asset paths in the .js files fingerprinted, too?

like image 781
chopper Avatar asked Sep 28 '22 18:09

chopper


1 Answers

I placed an image called car.jpeg under public/assets/images and then was able to reference it in my application.js route file as assets/images/car.jpeg

enter image description here

Works great

enter image description here

UPDATE

One picture is worth a thousand words... :)

enter image description here

like image 177
Kalman Avatar answered Oct 03 '22 01:10

Kalman