Closed emmanuelmillionaer closed 7 years ago
make yarn
make build_assets
make assets
All assets are located in app/frontend. Entry points for Webpacker are in app/frontend/packs.
app/frontend
app/frontend/packs
E.g in app/frontend/packs/application.js all files are required:
app/frontend/packs/application.js
// javascript import '../javascripts/helpers' import Editor from '../javascripts/editor' .... // stylesheets import '../stylesheets/application.scss' .... // images import '../images/static/accounts-banner-bg.jpg' import '../images/static/accounts-banner-icon.svg' .....
After you run make build_assets or make assets you can see the webpacker output in manifest.json: e.g
manifest.json
"application.js": "http://localhost:8080/packs/application.js", "application.scss": "http://localhost:8080/packs/application.scss", "accounts-banner-bg.jpg": "http://localhost:8080/packs/accounts-banner-bg.jpg" .....
You can access this webpacker assets, with the following new helper methods:
javascript_pack_tag stylesheet_pack_tag asset_pack_path
javascript_pack_tag
stylesheet_pack_tag
asset_pack_path
e.g: <%= stylesheet_pack_tag "application", media: "all" %> <%= javascript_pack_tag "vendor" %>
<%= stylesheet_pack_tag "application", media: "all" %>
<%= javascript_pack_tag "vendor" %>
I'm happy to hear your questions on the coding channel in Slack 🙂
What:
Related:
Deployment:
Usage:
make yarn
make build_assets
ormake assets
Explanation:
All assets are located in
app/frontend
. Entry points for Webpacker are inapp/frontend/packs
.E.g in
app/frontend/packs/application.js
all files are required:After you run
make build_assets
ormake assets
you can see the webpacker output inmanifest.json
: e.gYou can access this webpacker assets, with the following new helper methods:
javascript_pack_tag
stylesheet_pack_tag
asset_pack_path
e.g:
<%= stylesheet_pack_tag "application", media: "all" %>
<%= javascript_pack_tag "vendor" %>
Questions:
I'm happy to hear your questions on the coding channel in Slack 🙂