Skip to content

Commit

Permalink
Improve Netlify bundled configuration
Browse files Browse the repository at this point in the history
- Add support for using `netlify dev`. This is important if you want to test redirects or use functions.
- Removed Link headers. This was breaking stuff locally and Netlify doesn't have a way to apply headers conditionally without using scripts. Honestly, I'm not sure it's really that important anyway. I checked a bunch of sites including Google, Cloudflare, Netlify, Apple, Stripe, and more. None of them set these headers. This simplifies stuff to remove them.
  • Loading branch information
jclusso committed Feb 17, 2024
1 parent 94ec530 commit ffd857e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
2 changes: 0 additions & 2 deletions bridgetown-core/lib/bridgetown-core/configurations/netlify.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

copy_file in_templates_dir("netlify.toml"), "netlify.toml"
copy_file in_templates_dir("netlify.sh"), "bin/netlify.sh"
`chmod a+x ./bin/netlify.sh`

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
[dev]
command = "bin/bridgetown dev"
targetPort = 4000
port = 8888
publish = "output"
autoLaunch = true
framework = "#custom"

[context.dev.build.environment]
NODE_ENV = "development"
BRIDGETOWN_ENV = "development"

[build]
command = "bin/bridgetown deploy && bin/netlify.sh"
command = "bin/bridgetown deploy"
publish = "output"

[build.environment]
Expand All @@ -19,14 +31,6 @@
Referrer-Policy = "no-referrer-when-downgrade"
Cache-Control = "public, max-age=604800, s-max-age=604800"

[[headers]]
for = "/"
[headers.values]
Link = [
"<CSS_PATH>; rel=preload; as=style",
"<JS_PATH>; rel=preload; as=script"
]

[[headers]]
for = "/*.(png|jpg|js|css|svg|woff|ttf|eot|ico|woff2)"
[headers.values]
Expand Down

0 comments on commit ffd857e

Please sign in to comment.