From d19c9e2170a5d87ad81ccdadeae75c657960ff71 Mon Sep 17 00:00:00 2001 From: Jared White Date: Fri, 1 Nov 2024 17:28:02 -0700 Subject: [PATCH] fix fast refresh not working for Liquid templates (#933) --- .../lib/bridgetown-core/concerns/site/fast_refreshable.rb | 2 +- bridgetown-website/src/_docs/configuration/initializers.md | 3 +-- bridgetown-website/src/_docs/installation/upgrade.md | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bridgetown-core/lib/bridgetown-core/concerns/site/fast_refreshable.rb b/bridgetown-core/lib/bridgetown-core/concerns/site/fast_refreshable.rb index 921551779..12d256c2a 100644 --- a/bridgetown-core/lib/bridgetown-core/concerns/site/fast_refreshable.rb +++ b/bridgetown-core/lib/bridgetown-core/concerns/site/fast_refreshable.rb @@ -27,7 +27,6 @@ def fast_refresh(paths = [], reload_if_needed: false) # rubocop:todo Metrics self, layout.instance_variable_get(:@base), layout.name ) end - liquid_renderer.reset unless layouts_to_reload.empty? next unless res || !pages.empty? unless pages.empty? @@ -60,6 +59,7 @@ def fast_refresh(paths = [], reload_if_needed: false) # rubocop:todo Metrics Bridgetown::Hooks.trigger :site, :fast_refresh, self + liquid_renderer.reset transform_resources_for_fast_refresh(marked_resources, found_gen_pages) transform_generated_pages_for_fast_refresh diff --git a/bridgetown-website/src/_docs/configuration/initializers.md b/bridgetown-website/src/_docs/configuration/initializers.md index 413f5a50c..686b87a53 100644 --- a/bridgetown-website/src/_docs/configuration/initializers.md +++ b/bridgetown-website/src/_docs/configuration/initializers.md @@ -290,8 +290,7 @@ config.inflector.configure do |inflections| end ``` -Bridgetown's inflector is based on `Dry::Inflector`, so you can [read up on how to add inflection -rules here](https://dry-rb.org/gems/dry-inflector/1.0/#custom-inflection-rules). +Bridgetown's inflector is based on `Dry::Inflector`, so you can [read up on how to add inflection rules here](https://dry-rb.org/gems/dry-inflector/1.0/#custom-inflection-rules). ### Parse Roda Routes diff --git a/bridgetown-website/src/_docs/installation/upgrade.md b/bridgetown-website/src/_docs/installation/upgrade.md index 9779a2398..31f101f36 100644 --- a/bridgetown-website/src/_docs/installation/upgrade.md +++ b/bridgetown-website/src/_docs/installation/upgrade.md @@ -63,7 +63,7 @@ Bridgetown v2 has removed a number of dependencies in the codebase on the Active ### Caveats with Fast Refresh in Development ⏩ -Bridgetown v2 comes with a "fast refresh" feature by default. This rebuilds only files needed to display updated content in source files, rather than the entire website from scratch. However, certain features aren't yet compatible with fast refresh—most notabily, **i18n**. If you're using multiple locales in your project, you will likely want to disable fast refresh so you don't end up with broken pages/links by setting `fast_refresh` to `false` in your config. +Bridgetown v2 comes with a "fast refresh" feature by default. This rebuilds only files needed to display updated content in source files, rather than the entire website from scratch. However, certain features aren't yet compatible with fast refresh—most notabily, **i18n**. If you're using multiple locales in your project, you will likely want to disable fast refresh so you don't end up with broken pages/links by setting `fast_refresh false` in `config/initializers.rb`. ### Quick Search and Other Plugins 🔍