teamspaces / web

Web & API – Spaces is knowledge management for teams.
0 stars 0 forks source link

Update to rails 5.1.2, use rails webpacker #311

Closed emmanuelmillionaer closed 7 years ago

emmanuelmillionaer commented 7 years ago

What:

Related:

Deployment:

Usage:

  1. make yarn
  2. make build_assets or make assets

Explanation:

All assets are located in app/frontend. Entry points for Webpacker are in app/frontend/packs.

E.g in app/frontend/packs/application.js all files are required:

// 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

"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

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 🙂