Skip to content

Commit

Permalink
Remove webpack integration from Bridgetown (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite authored Mar 17, 2024
1 parent c2cc31d commit 2a413fc
Show file tree
Hide file tree
Showing 44 changed files with 80 additions and 665 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Bridgetown development is spearheaded by Portland-based web studio [Whitefusion]
* Customize the [Permalinks](https://www.bridgetownrb.com/docs/content/permalinks/) your resources are generated with
* Use [Template Engines](https://www.bridgetownrb.com/docs/template-engines) like Liquid, ERB, and Serbea to author sophisticated template designs
* Extend with [Custom Plugins](https://www.bridgetownrb.com/docs/plugins/) to generate and manipulate content specific to your site
* Discover how to add [Frontend Assets](https://www.bridgetownrb.com/docs/frontend-assets/) using esbuild or Webpack for a modern Javascript & CSS build pipeline
* Discover how to add [Frontend Assets](https://www.bridgetownrb.com/docs/frontend-assets/) using esbuild for a modern Javascript & CSS build pipeline

## Testing Locally

Expand Down
19 changes: 9 additions & 10 deletions bridgetown-core/lib/bridgetown-core/commands/new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def self.banner
desc: "Preferred template engine (defaults to Liquid)"
class_option :"frontend-bundling",
aliases: "-e",
banner: "esbuild|webpack",
desc: "Choose your frontend bundling stack (defaults to esbuild)"
banner: "esbuild",
desc: "Choose frontend bundling stack (defaults to esbuild)"
class_option :force,
type: :boolean,
desc: "Force creation even if PATH already exists"
Expand Down Expand Up @@ -91,15 +91,16 @@ def preserve_source_location?(path, options)
end

def frontend_bundling_option
options["frontend-bundling"] == "webpack" ? "webpack" : "esbuild"
"esbuild"
end

def postcss_option
!options["use-sass"]
end

def disable_postcss?
options["use-sass"] && options["frontend-bundling"] == "webpack"
# TODO: add option not to use postcss/sass at all
false
end

def create_site(new_site_path)
Expand Down Expand Up @@ -130,11 +131,9 @@ def create_site(new_site_path)

postcss_option ? configure_postcss : configure_sass

if frontend_bundling_option == "esbuild"
invoke(Esbuild, ["setup"], {})
else
invoke(Webpack, ["setup"], {})
end
return unless frontend_bundling_option == "esbuild"

invoke(Esbuild, ["setup"], {})
end

def setup_erb_templates
Expand Down Expand Up @@ -172,7 +171,7 @@ def configure_sass
end

def configure_postcss
template("postcss.config.js.erb", "postcss.config.js")
template("postcss.config.js.erb", "postcss.config.js") unless disable_postcss?
copy_file("frontend/styles/index.css")
end

Expand Down
2 changes: 1 addition & 1 deletion bridgetown-core/lib/bridgetown-core/commands/start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def output_header(mode)
sleep 0.5
raise e
ensure
# Shut down webpack, browsersync, etc. if they're running
# Shut down esbuild, etc. if they're running
Bridgetown::Utils::Aux.kill_processes
end

Expand Down
82 changes: 0 additions & 82 deletions bridgetown-core/lib/bridgetown-core/commands/webpack.rb

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions bridgetown-core/lib/bridgetown-core/commands/webpack/setup.rb

This file was deleted.

24 changes: 0 additions & 24 deletions bridgetown-core/lib/bridgetown-core/commands/webpack/update.rb

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
error_message = "#{"postcss.config.js".bold} not found. Please configure postcss in your project."

@logger.error "\nError:".red, "🚨 #{error_message}"
@logger.info "\nRun #{"bridgetown webpack enable-postcss".bold.blue} to set it up.\n"

return
end
Expand Down
Loading

0 comments on commit 2a413fc

Please sign in to comment.