snowpack dev
- Bridgetown builds to
bridgetown/
- Snowpack builds that output + output of your frontend assets to
out/
- Runs with hot reloading on localhost:8080
- Build for production
BRIDGETOWN_ENV=production snowpack build
Last active
July 6, 2021 13:55
-
-
Save andrewmcodes/0b16db1f0f48f8634f5b187c32fec2c0 to your computer and use it in GitHub Desktop.
Snowpack + Bridgetown + Tailwind + Vercel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Docs: https://www.bridgetownrb.com/docs/configuration/options/ | |
# | |
# Change the directory where Bridgetown will write files. | |
# 🚨 Referenced on line 8 of `snowpack.config.mjs` | |
destination: bridgetown | |
# Change the template engine Bridgetown uses by default to process content files. This is OPTIONAL unless you want to use ERB. | |
template_engine: erb | |
permalink: simple | |
timezone: America/Phoenix | |
content_engine: resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- ... --> | |
<link rel="stylesheet" type="text/css" href="/dist/styles/index.css" /> | |
<!-- ... --> | |
<body class="<%= class_map "debug-screens": Bridgetown.env.development? %>"> | |
<div class="min-h-screen bg-primary-black"> | |
<%= render "site_header" %> | |
<main class="mx-auto"> | |
<%= yield %> | |
</main> | |
</div> | |
<%= render "footer", metadata: site.metadata %> | |
<!-- Include JS in your layout or a partial in your layout --> | |
<script type="module" src="/dist/javascript/index.js"></script> | |
<!-- --> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.snowpack.dev/reference/configuration | |
// note that as of 2021-07-06 06:36 this has not had the optimizations cranked up for the final production deploy though this could be used as is if you’re using a similar stack (ie postcss instead of sass). Excuse any mess. | |
/** @type {import("snowpack").SnowpackUserConfig } */ | |
export default { | |
mount: { | |
bridgetown: { url: "/", static: true }, | |
frontend: "/dist", | |
}, | |
exclude: ["**/node_modules/**/*", "**/.vercel/**/*", "**/tmp/**/*"], | |
plugins: [ | |
"@snowpack/plugin-postcss", | |
[ | |
"@snowpack/plugin-run-script", | |
{ | |
name: "bridgetown", | |
cmd: "bundle exec bridgetown build", | |
watch: "$1 --watch --quiet", | |
}, | |
], | |
], | |
packageOptions: { | |
// types: true, | |
NODE_ENV: true, | |
}, | |
devOptions: { | |
tailwindConfig: "./tailwind.config.js", | |
open: "none", | |
hmrDelay: 300, | |
output: "stream", | |
}, | |
buildOptions: { | |
out: "output", | |
// metaUrlPath: "snowpack", | |
sourcemap: false, | |
}, | |
optimize: { | |
// bundle: true, | |
// minify: true, | |
target: "es2018", | |
sourcemap: false, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment