Skip to content

Instantly share code, notes, and snippets.

@robacarp
Last active January 30, 2022 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robacarp/6114926b6698a09a8f1d064be7c4e01a to your computer and use it in GitHub Desktop.
Save robacarp/6114926b6698a09a8f1d064be7c4e01a to your computer and use it in GitHub Desktop.
Lucky with Parcel Bundler
+public/_entrypoint.html
+public/*.js
+public/*.css
+public/*.map
<!doctype html>
<!--
src/_entrypoint.html
This is the Parcel entrypoint file. It should have a link/script tag for each asset
which your src/components/shared/layout_head.cr references.
The true entrypoint into your application is your src/pages/layout, but that's not
available to parcel in a way that parcel can understand. This is a cheap hack to
inform parcel of the files that need to be added to the bundles.
-->
<html>
<head>
<link href="css/app.scss" rel="stylesheet" media="screen">
<script src="js/app.js" defer="true"></script>
</head>
<body>
</body>
</html>
# trick lucky into reading the manifest emitted by parcel-plugin-bundle-manifest until
# https://github.com/luckyframework/lucky/issues/1382 is resolved
ln -s parcel-manifest.json mix-manifest.json
{
"license": "UNLICENSED",
"private": true,
"dependencies": {
- "browser-sync": "^2.18.13",
"@rails/ujs": "^6.0.0",
"bootstrap": "^4.5.3",
"jquery": "1.9.1 - 3",
+ "parcel-bundler": "^1.12.4",
+ "parcel-plugin-bundle-manifest": "^0.2.0",
"popper.js": "^1.16.1",
"rails-ujs": "^5.2.4-4",
"turbolinks": "^5.2.0"
- "@babel/compat-data": "^7.9.0"
},
"scripts": {
- "heroku-postbuild": "yarn prod",
- "dev": "yarn run webpack --progress --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js",
- "watch": "yarn run webpack --watch --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js",
- "prod": "NODE_ENV=production yarn run webpack --progress --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js"
+ "watch": "yarn run parcel watch --no-autoinstall -d public --log-level 3 src/_entrypoint.html",
+ "prod": "yarn run parcel build --no-autoinstall -d public --log-level 3 src/_entrypoint.html"
},
"devDependencies": {
+ "browser-sync": "^2.26.7",
"sass": "1.17.1",
- "compression-webpack-plugin": "^3.0.0",
- "laravel-mix": "^4.0.0",
- "resolve-url-loader": "2.3.1",
- "vue-template-compiler": "^2.5.22",
+ "postcss-modules": "^3.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment