Skip to content

Commit 04477fa

Browse files
guilleiguarangauravtiwari
authored andcommitted
Add an example about how to load images under app/javascript/images in the generated file (#1976)
1 parent 0b86cad commit 04477fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/install/javascript/packs/application.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@
77
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
88
// layout file, like app/views/layouts/application.html.erb
99

10+
11+
// Uncomment to copy all static images under ../images to the output folder and reference
12+
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
13+
// or the `imagePath` JavaScript helper below.
14+
//
15+
// const images = require.context('../images', true)
16+
// const imagePath = (name) => images(name, true)
17+
1018
console.log('Hello World from Webpacker')

0 commit comments

Comments
 (0)