Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
app
bin
config
lib
log
public
tmp
vendor
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
config.ru
package-lock.json
package.json

README.md

Simpacker parcel example

Install packages

$ npm install --save-dev parcel-bundler parcel-plugin-bundle-manifest

Add files

config/simpacker.yml

default: &default
  manifest_path: public/packs/parcel-manifest.json

development:
  <<: *default
  cache_manifest: false

test:
  <<: *default
  cache_manifest: false

production:
  <<: *default
  cache_manifest: true

app/javascript/application.js

import { hello } from "./greeter";

document.addEventListener("DOMContentLoaded", () => {
  const el = document.getElementById("app");
  if (el) {
    el.textContent = hello("Rails");
  }
});

app/javascript/greeter.js

export function hello(name) {
  return `Hello ${name}!`;
}

app/javascript/index.html

<script src="./application.js"></script>

Run parcel

$ ./node_modules/.bin/parcel watch --out-dir public/packs --public-url /packs app/javascript/index.html
You can’t perform that action at this time.