From 02caad4e0613404d535f804ebffe70ee3fc496da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20Mari=C3=A9?= Date: Fri, 19 Jan 2024 15:38:54 +0100 Subject: [PATCH 01/23] Synchronize bin/dev from jsbundling-rails to cssbundling-rails (#151) There are different bin/dev being generated by cssbundling-rails and jsbundling-rails See https://github.com/rails/jsbundling-rails/pull/174 > dev: Use an affirmative conditional > > ...and avoid regex in match. > > (Try a gem list ails vs a gem list --exact ails to see what I mean.) --- lib/install/dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install/dev b/lib/install/dev index a4e05fa..eda330c 100755 --- a/lib/install/dev +++ b/lib/install/dev @@ -1,6 +1,6 @@ #!/usr/bin/env sh -if ! gem list foreman -i --silent; then +if gem list --no-installed --exact --silent foreman; then echo "Installing foreman..." gem install foreman fi From 7638f924d7376f8fa1fcd1af65f7d673e94b9321 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Sun, 21 Jan 2024 13:23:32 -0600 Subject: [PATCH 02/23] Use Thor's `apply` instead of a prerequisite task (#150) The `css:install:shared` task serves only as a prerequisite for the other installer tasks; it should not be run on its own (nor listed with `rake --tasks`). By replacing this task with corresponding calls to Thor's `apply` method, we avoid the overhead of running `bin/rails app:template` (and `bundle install`) multiple times. --- lib/install/bootstrap/install.rb | 2 ++ lib/install/bulma/install.rb | 2 ++ lib/install/postcss/install.rb | 2 ++ lib/install/sass/install.rb | 2 ++ lib/install/tailwind/install.rb | 2 ++ lib/tasks/cssbundling/install.rake | 15 +++++---------- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/install/bootstrap/install.rb b/lib/install/bootstrap/install.rb index bfea9b0..f00991e 100644 --- a/lib/install/bootstrap/install.rb +++ b/lib/install/bootstrap/install.rb @@ -1,6 +1,8 @@ require_relative "../helpers" self.extend Helpers +apply "#{__dir__}/../install.rb" + say "Install Bootstrap with Bootstrap Icons, Popperjs/core and Autoprefixer" copy_file "#{__dir__}/application.bootstrap.scss", "app/assets/stylesheets/application.bootstrap.scss" diff --git a/lib/install/bulma/install.rb b/lib/install/bulma/install.rb index c5276d0..a6de35a 100644 --- a/lib/install/bulma/install.rb +++ b/lib/install/bulma/install.rb @@ -1,6 +1,8 @@ require_relative "../helpers" self.extend Helpers +apply "#{__dir__}/../install.rb" + say "Install Bulma" copy_file "#{__dir__}/application.bulma.scss", "app/assets/stylesheets/application.bulma.scss" diff --git a/lib/install/postcss/install.rb b/lib/install/postcss/install.rb index d9eb5bd..e80280b 100644 --- a/lib/install/postcss/install.rb +++ b/lib/install/postcss/install.rb @@ -1,6 +1,8 @@ require_relative "../helpers" self.extend Helpers +apply "#{__dir__}/../install.rb" + say "Install PostCSS w/ nesting and autoprefixer" copy_file "#{__dir__}/postcss.config.js", "postcss.config.js" copy_file "#{__dir__}/application.postcss.css", "app/assets/stylesheets/application.postcss.css" diff --git a/lib/install/sass/install.rb b/lib/install/sass/install.rb index 692d60e..b05a8e5 100644 --- a/lib/install/sass/install.rb +++ b/lib/install/sass/install.rb @@ -1,6 +1,8 @@ require_relative "../helpers" self.extend Helpers +apply "#{__dir__}/../install.rb" + say "Install Sass" copy_file "#{__dir__}/application.sass.scss", "app/assets/stylesheets/application.sass.scss" run "#{bundler_cmd} add sass" diff --git a/lib/install/tailwind/install.rb b/lib/install/tailwind/install.rb index 7374ff4..f8e530d 100644 --- a/lib/install/tailwind/install.rb +++ b/lib/install/tailwind/install.rb @@ -1,6 +1,8 @@ require_relative "../helpers" self.extend Helpers +apply "#{__dir__}/../install.rb" + say "Install Tailwind (+PostCSS w/ autoprefixer)" copy_file "#{__dir__}/tailwind.config.js", "tailwind.config.js" copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css" diff --git a/lib/tasks/cssbundling/install.rake b/lib/tasks/cssbundling/install.rake index d093d8d..ba1df4c 100644 --- a/lib/tasks/cssbundling/install.rake +++ b/lib/tasks/cssbundling/install.rake @@ -1,32 +1,27 @@ namespace :css do namespace :install do - desc "Install shared elements for all bundlers" - task :shared do - system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/install.rb", __dir__)}" - end - desc "Install Tailwind" - task tailwind: "css:install:shared" do + task :tailwind do system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/tailwind/install.rb", __dir__)}" end desc "Install PostCSS" - task postcss: "css:install:shared" do + task :postcss do system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/postcss/install.rb", __dir__)}" end desc "Install Sass" - task sass: "css:install:shared" do + task :sass do system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/sass/install.rb", __dir__)}" end desc "Install Bootstrap" - task bootstrap: "css:install:shared" do + task :bootstrap do system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/bootstrap/install.rb", __dir__)}" end desc "Install Bulma" - task bulma: "css:install:shared" do + task :bulma do system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/bulma/install.rb", __dir__)}" end end From 9075819d32c7e1103b1ee7c237e79001547066af Mon Sep 17 00:00:00 2001 From: Tyler Paige Date: Sun, 21 Jan 2024 14:24:58 -0500 Subject: [PATCH 03/23] Add instructions for including 3rd party packages in bundle (#148) See discussion in issue #92 https://github.com/rails/cssbundling-rails/issues/92 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a6c1db4..9e7c24f 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,15 @@ Watch out - if you precompile your files locally, those will be served over the rails assets:clobber ``` +### How do I include 3rd party stylesheets from `node_modules` in my bundle? + +Use an `@import` statement and path to a specific stylesheet, omitting the `node_modules/` segment and the file's extension. For example: + +```scss +/* Desired file is at at node_modules/select2/dist/css/select2.css */ +@import "select2/dist/css/select2"; +``` + ## License CSS Bundling for Rails is released under the [MIT License](https://opensource.org/licenses/MIT). From 3e768cdabf51bb5955388804a6a56ad26febfb5c Mon Sep 17 00:00:00 2001 From: Hartley McGuire Date: Sun, 21 Jan 2024 14:26:16 -0500 Subject: [PATCH 04/23] Fix running "rails new --css bootstrap" on 7.1 (#147) Rails 7.1 included a [change][1] to allow using importmaps along with all cssbundling options. However, the Bootstrap installer was never updated to take this new default into effect (and is currently broken because of this). This commit adds the additional configuration required to use the Bootstrap npm package with importmaps so that "rails new" generates an application that runs without errors. [1]: rails/rails@84458a8577e09621205f2ea86f570745033105f5 --- lib/install/bootstrap/install.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/install/bootstrap/install.rb b/lib/install/bootstrap/install.rb index f00991e..abf8e1d 100644 --- a/lib/install/bootstrap/install.rb +++ b/lib/install/bootstrap/install.rb @@ -21,6 +21,19 @@ say %(Add import * as bootstrap from "bootstrap" to your entry point JavaScript file), :red end +if Rails.root.join("config/importmap.rb").exist? + say "Pin Bootstrap" + append_to_file "config/importmap.rb", %(pin "bootstrap", to: "bootstrap.min.js"\n) + + inject_into_file "config/initializers/assets.rb", after: /.*Rails.application.config.assets.paths.*\n/ do + <<~RUBY + Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js") + RUBY + end + + append_to_file "config/initializers/assets.rb", %(Rails.application.config.assets.precompile << "bootstrap.min.js") +end + add_package_json_script("build:css:compile", "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules") add_package_json_script("build:css:prefix", "postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css") add_package_json_script("build:css", "#{bundler_run_cmd} build:css:compile && #{bundler_run_cmd} build:css:prefix") From e650c9ab135504cc2f8b8405c41cdebad5ede66f Mon Sep 17 00:00:00 2001 From: Kevin Sylvestre Date: Sun, 21 Jan 2024 11:27:25 -0800 Subject: [PATCH 05/23] PNPM Support (#145) * Simplify build tool selection for bun / yarn Simplifying ahead of introducing NPM as a build tool. * Support for NPM * Support PNPM --- lib/tasks/cssbundling/build.rake | 33 ++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/lib/tasks/cssbundling/build.rake b/lib/tasks/cssbundling/build.rake index dcdd429..8410147 100644 --- a/lib/tasks/cssbundling/build.rake +++ b/lib/tasks/cssbundling/build.rake @@ -22,15 +22,36 @@ module Cssbundling extend self def install_command - return "bun install" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock')) - return "yarn install" if File.exist?('yarn.lock') || tool_exists?('yarn') - raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies" + case tool + when :bun then "bun install" + when :yarn then "yarn install" + when :pnpm then "pnpm install" + when :npm then "npm install" + else raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies" + end end def build_command - return "bun run build:css" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock')) - return "yarn build:css" if File.exist?('yarn.lock') || tool_exists?('yarn') - raise "cssbundling-rails: No suitable tool found for building CSS" + case tool + when :bun then "bun run build:css" + when :yarn then "yarn build:css" + when :pnpm then "pnpm build:css" + when :npm then "npm run build:css" + else raise "cssbundling-rails: No suitable tool found for building CSS" + end + end + + def tool + case + when File.exist?('bun.lockb') then :bun + when File.exist?('yarn.lock') then :yarn + when File.exist?('pnpm-lock.yaml') then :pnpm + when File.exist?('package-lock.json') then :npm + when tool_exists?('bun') then :bun + when tool_exists?('yarn') then :yarn + when tool_exists?('pnpm') then :pnpm + when tool_exists?('npm') then :npm + end end def tool_exists?(tool) From f9e6dc47b44bca53174e03f9ba504fde5648576d Mon Sep 17 00:00:00 2001 From: dhh Date: Sun, 21 Jan 2024 11:37:24 -0800 Subject: [PATCH 06/23] Bump version for 1.4.0 --- Gemfile.lock | 2 +- lib/cssbundling/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f44fffc..63a04a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cssbundling-rails (1.3.3) + cssbundling-rails (1.4.0) railties (>= 6.0.0) GEM diff --git a/lib/cssbundling/version.rb b/lib/cssbundling/version.rb index 5b6d7ae..e7ff022 100644 --- a/lib/cssbundling/version.rb +++ b/lib/cssbundling/version.rb @@ -1,3 +1,3 @@ module Cssbundling - VERSION = "1.3.3" + VERSION = "1.4.0" end From 09d81cb0accf00abb77d8af5b24f5aad0b71a57a Mon Sep 17 00:00:00 2001 From: dhh Date: Sun, 21 Jan 2024 12:10:24 -0800 Subject: [PATCH 07/23] Fix escaping issue with bootstrap command Fixed #137 --- lib/install/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install/helpers.rb b/lib/install/helpers.rb index b8837f8..dd4e974 100644 --- a/lib/install/helpers.rb +++ b/lib/install/helpers.rb @@ -21,7 +21,7 @@ def add_package_json_script(name, script, run_script=true) if using_bun? package_json = JSON.parse(File.read("package.json")) package_json["scripts"] ||= {} - package_json["scripts"][name] = script + package_json["scripts"][name] = script.gsub('\\"', '"') File.write("package.json", JSON.pretty_generate(package_json)) run %(bun run #{name}) if run_script else From 154c8b7016bf1b9c8d34188f6c803a41c1beb6fa Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 Jul 2024 11:02:00 -0700 Subject: [PATCH 08/23] Refresh dependencies (and unblock the use of Ruby 3.3.4 from a hard nokogiri cap) --- Gemfile.lock | 246 ++++++++++++++++++++++++++++----------------------- 1 file changed, 136 insertions(+), 110 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 63a04a7..5a255f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,166 +7,192 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3.1) - actionpack (= 6.1.3.1) - activesupport (= 6.1.3.1) + actioncable (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3.1) - actionpack (= 6.1.3.1) - activejob (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionmailbox (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) mail (>= 2.7.1) - actionmailer (6.1.3.1) - actionpack (= 6.1.3.1) - actionview (= 6.1.3.1) - activejob (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionmailer (6.1.7.8) + actionpack (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activesupport (= 6.1.7.8) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3.1) - actionview (= 6.1.3.1) - activesupport (= 6.1.3.1) + actionpack (6.1.7.8) + actionview (= 6.1.7.8) + activesupport (= 6.1.7.8) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3.1) - actionpack (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + actiontext (6.1.7.8) + actionpack (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) nokogiri (>= 1.8.5) - actionview (6.1.3.1) - activesupport (= 6.1.3.1) + actionview (6.1.7.8) + activesupport (= 6.1.7.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.3.1) - activesupport (= 6.1.3.1) + activejob (6.1.7.8) + activesupport (= 6.1.7.8) globalid (>= 0.3.6) - activemodel (6.1.3.1) - activesupport (= 6.1.3.1) - activerecord (6.1.3.1) - activemodel (= 6.1.3.1) - activesupport (= 6.1.3.1) - activestorage (6.1.3.1) - actionpack (= 6.1.3.1) - activejob (= 6.1.3.1) - activerecord (= 6.1.3.1) - activesupport (= 6.1.3.1) - marcel (~> 1.0.0) - mini_mime (~> 1.0.2) - activesupport (6.1.3.1) + activemodel (6.1.7.8) + activesupport (= 6.1.7.8) + activerecord (6.1.7.8) + activemodel (= 6.1.7.8) + activesupport (= 6.1.7.8) + activestorage (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activesupport (= 6.1.7.8) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - builder (3.2.4) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + builder (3.3.0) byebug (11.1.3) - capybara (3.35.3) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (3.0.0) - concurrent-ruby (1.1.9) + concurrent-ruby (1.3.3) crass (1.0.6) - erubi (1.10.0) - globalid (0.5.1) - activesupport (>= 5.0) - i18n (1.8.10) + date (3.3.4) + erubi (1.13.0) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) - loofah (2.10.0) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.0.3) - minitest (5.14.4) - nio4r (2.5.7) - nokogiri (1.15.2-aarch64-linux) + net-imap + net-pop + net-smtp + marcel (1.0.4) + matrix (0.4.2) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.24.1) + net-imap (0.4.14) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.3) + nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) - nokogiri (1.15.2-arm64-darwin) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.2-x86_64-darwin) + nokogiri (1.16.7-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - public_suffix (4.0.6) - racc (1.7.1) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.3.1) - actioncable (= 6.1.3.1) - actionmailbox (= 6.1.3.1) - actionmailer (= 6.1.3.1) - actionpack (= 6.1.3.1) - actiontext (= 6.1.3.1) - actionview (= 6.1.3.1) - activejob (= 6.1.3.1) - activemodel (= 6.1.3.1) - activerecord (= 6.1.3.1) - activestorage (= 6.1.3.1) - activesupport (= 6.1.3.1) + public_suffix (6.0.1) + racc (1.8.0) + rack (2.2.9) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.8) + actioncable (= 6.1.7.8) + actionmailbox (= 6.1.7.8) + actionmailer (= 6.1.7.8) + actionpack (= 6.1.7.8) + actiontext (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activemodel (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) bundler (>= 1.15.0) - railties (= 6.1.3.1) + railties (= 6.1.7.8) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.3.1) - actionpack (= 6.1.3.1) - activesupport (= 6.1.3.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) method_source - rake (>= 0.8.7) + rake (>= 12.2) thor (~> 1.0) - rake (13.0.6) - regexp_parser (2.1.1) - rexml (3.2.5) + rake (13.2.1) + regexp_parser (2.9.2) + rexml (3.3.2) + strscan rubyzip (2.3.2) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - sprockets (4.0.2) + selenium-webdriver (4.10.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.4.2) - stimulus-rails (0.3.8) - rails (>= 6.0.0) - thor (1.1.0) - turbo-rails (0.7.4) - rails (>= 6.0.0) - tzinfo (2.0.4) + sqlite3 (2.0.2-aarch64-linux-gnu) + sqlite3 (2.0.2-arm64-darwin) + sqlite3 (2.0.2-x86_64-darwin) + sqlite3 (2.0.2-x86_64-linux-gnu) + stimulus-rails (1.3.3) + railties (>= 6.0.0) + strscan (3.1.0) + thor (1.3.1) + timeout (0.4.1) + turbo-rails (2.0.6) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - webdrivers (4.6.0) + webdrivers (5.3.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.5) + selenium-webdriver (~> 4.0, < 4.11) + websocket (1.2.11) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.4.2) + zeitwerk (2.6.16) PLATFORMS aarch64-linux From e7261fb8ce4650f8d253d95089a8529dc5cb5edc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 Jul 2024 11:18:07 -0700 Subject: [PATCH 09/23] Overwrite bin/dev by force to deal with new default bin/dev file See Rails #52433 --- lib/install/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install/install.rb b/lib/install/install.rb index b241602..0e9129f 100644 --- a/lib/install/install.rb +++ b/lib/install/install.rb @@ -54,5 +54,5 @@ end say "Add bin/dev to start foreman" -copy_file "#{__dir__}/dev", "bin/dev" +copy_file "#{__dir__}/dev", "bin/dev", force: true chmod "bin/dev", 0755, verbose: false From 3ae4ceaed48089c118bd3d5b71d81c8c66878bef Mon Sep 17 00:00:00 2001 From: Felix Tscheulin Date: Mon, 29 Jul 2024 20:55:34 +0200 Subject: [PATCH 10/23] Disable loading .env file when running foreman for development (#155) --- lib/install/dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install/dev b/lib/install/dev index eda330c..d80a02d 100755 --- a/lib/install/dev +++ b/lib/install/dev @@ -8,4 +8,4 @@ fi # Default to port 3000 if not specified export PORT="${PORT:-3000}" -exec foreman start -f Procfile.dev "$@" +exec foreman start -f Procfile.dev --env /dev/null "$@" From 316bc7d696525d80672d120973d1dced3c80d6fc Mon Sep 17 00:00:00 2001 From: mark-young-atg <113439900+mark-young-atg@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:58:57 +0100 Subject: [PATCH 11/23] Provide a 'Changelog' link on rubygems.org/gems/cssbundling-rails (#152) By providing a 'changelog_uri' in the metadata of the gemspec a 'Changelog' link will be shown on https://rubygems.org/gems/cssbundling-rails which makes it quick and easy for someone to check on the changes introduced with a new version. Details of this functionality can be found on https://guides.rubygems.org/specification-reference/ --- cssbundling-rails.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cssbundling-rails.gemspec b/cssbundling-rails.gemspec index 8149990..c185989 100644 --- a/cssbundling-rails.gemspec +++ b/cssbundling-rails.gemspec @@ -12,4 +12,6 @@ Gem::Specification.new do |spec| spec.files = Dir["lib/**/*", "MIT-LICENSE", "README.md"] spec.add_dependency "railties", ">= 6.0.0" + + spec.metadata["changelog_uri"] = spec.homepage + "/releases" end From 4f4c62148bbee215a4694d6970be30f17c3066dd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 Jul 2024 12:01:23 -0700 Subject: [PATCH 12/23] Bump version for 1.4.1 --- Gemfile.lock | 2 +- lib/cssbundling/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5a255f9..bbda716 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cssbundling-rails (1.4.0) + cssbundling-rails (1.4.1) railties (>= 6.0.0) GEM diff --git a/lib/cssbundling/version.rb b/lib/cssbundling/version.rb index e7ff022..72f5ad2 100644 --- a/lib/cssbundling/version.rb +++ b/lib/cssbundling/version.rb @@ -1,3 +1,3 @@ module Cssbundling - VERSION = "1.4.0" + VERSION = "1.4.1" end From 123569431c0e303c1aca8b275b2d1bc3c68a3a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20=C3=96zbek?= Date: Sat, 5 Oct 2024 02:40:26 +0200 Subject: [PATCH 13/23] Update README.md (#157) Clarify that `cssbundling` isn't used if you run `rails new --css=tailwind` or `--css=dart` --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e7c24f..a3b2647 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,7 @@ You must already have node and yarn installed on your system. You will also need 1. Run `./bin/bundle add cssbundling-rails` 2. Run `./bin/rails css:install:[tailwind|bootstrap|bulma|postcss|sass]` -Or, in Rails 7+, you can preconfigure your new application to use a specific bundler with `rails new myapp --css [tailwind|bootstrap|bulma|postcss|sass]`. - +Or, in Rails 7+, you can preconfigure your new application to use `cssbundling-rails` for `bootstrap`, `bulma` or `postcss` with `rails new myapp --css [bootstrap|bulma|postcss]`. ## FAQ @@ -31,6 +30,8 @@ Or, in Rails 7+, you can preconfigure your new application to use a specific bun If you're already relying on Node to process your JavaScript, this gem is the way to go. But if you're using [the default import map setup in Rails 7+](https://github.com/rails/importmap-rails/), you can avoid having to deal with Node at all by using the standalone versions of Tailwind CSS and Dart Sass that are available through [tailwindcss-rails](https://github.com/rails/tailwindcss-rails/) and [dartsass-rails](https://github.com/rails/dartsass-rails/). It's simpler, fewer moving parts, and still has all the functionality. +In Rails 7+, you can preconfigure your new application to use `tailwindcss-rails` and `dartsass-rails` with `rails new myapp --css [tailwind|sass]`. + ### How do I import relative CSS files with Tailwind? If you want to use `@import` statements as part of your Tailwind application.js file, you need to [configure Tailwind to use `postcss` and then `postcss-import`](https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports). But you should also consider simply referring to your other CSS files directly, instead of bundling them all into one big file. It's better for caching, and it's simpler to setup. You can refer to other CSS files by expanding the `stylesheet_link_tag` in `application.html.erb` like so: `<%= stylesheet_link_tag "application", "other", "styles", "data-turbo-track": "reload" %>`. From df70d230264312a2dab2c44846c2b48c728a5594 Mon Sep 17 00:00:00 2001 From: Andy Leverenz Date: Mon, 24 Feb 2025 06:24:58 -0600 Subject: [PATCH 14/23] Update for Tailwind CSS v4 (#164) * Update for Tailwind CSS v4 Tailwind CSS v4 comes with new configurations and build scripts. This updates the installer for Tailwind to include those changes. * Add support for either bunx or npx --- README.md | 13 +++++++++---- lib/install/helpers.rb | 4 ++++ lib/install/tailwind/application.tailwind.css | 4 +--- lib/install/tailwind/install.rb | 7 +++---- lib/install/tailwind/package.json | 2 +- lib/install/tailwind/tailwind.config.js | 8 -------- 6 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 lib/install/tailwind/tailwind.config.js diff --git a/README.md b/README.md index a3b2647..5413d03 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ This also happens in testing where the bundler attaches to the `test:prepare` ta That's it! -You can configure your bundler options in the `build:css` script in `package.json` or via the installer-generated `tailwind.config.js` for Tailwind or `postcss.config.js` for PostCSS. - +You can configure your bundler options in the `build:css` script in `package.json` or `postcss.config.js` for PostCSS. ## Installation @@ -34,7 +33,13 @@ In Rails 7+, you can preconfigure your new application to use `tailwindcss-rails ### How do I import relative CSS files with Tailwind? -If you want to use `@import` statements as part of your Tailwind application.js file, you need to [configure Tailwind to use `postcss` and then `postcss-import`](https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports). But you should also consider simply referring to your other CSS files directly, instead of bundling them all into one big file. It's better for caching, and it's simpler to setup. You can refer to other CSS files by expanding the `stylesheet_link_tag` in `application.html.erb` like so: `<%= stylesheet_link_tag "application", "other", "styles", "data-turbo-track": "reload" %>`. +Tailwind CSS 4 is configured using native CSS. Instead of bundling all your CSS into a single file, consider referencing individual CSS files directly. This approach simplifies setup and improves caching performance. To reference multiple CSS files in Rails, update the stylesheet_link_tag in application.html.erb like this: + +```erb +<%= stylesheet_link_tag "application", "other", "styles", "data-turbo-track": "reload" %> +``` + +This ensures your files are properly linked and ready to use. ### How do I avoid SassC::SyntaxError exceptions on existing projects? @@ -58,7 +63,7 @@ Rails.application.config.assets.css_compressor = nil Watch out - if you precompile your files locally, those will be served over the dynamically created ones you expect. The solution: ```shell -rails assets:clobber +rails assets:clobber ``` ### How do I include 3rd party stylesheets from `node_modules` in my bundle? diff --git a/lib/install/helpers.rb b/lib/install/helpers.rb index dd4e974..a2b9e6a 100644 --- a/lib/install/helpers.rb +++ b/lib/install/helpers.rb @@ -9,6 +9,10 @@ def bundler_run_cmd using_bun? ? "bun run" : "yarn" end + def bundler_x_cmd + using_bun? ? "bunx" : "npx" + end + def using_bun? File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock')) end diff --git a/lib/install/tailwind/application.tailwind.css b/lib/install/tailwind/application.tailwind.css index b5c61c9..f1d8c73 100644 --- a/lib/install/tailwind/application.tailwind.css +++ b/lib/install/tailwind/application.tailwind.css @@ -1,3 +1 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +@import "tailwindcss"; diff --git a/lib/install/tailwind/install.rb b/lib/install/tailwind/install.rb index f8e530d..3b7181e 100644 --- a/lib/install/tailwind/install.rb +++ b/lib/install/tailwind/install.rb @@ -3,11 +3,10 @@ apply "#{__dir__}/../install.rb" -say "Install Tailwind (+PostCSS w/ autoprefixer)" -copy_file "#{__dir__}/tailwind.config.js", "tailwind.config.js" +say "Install Tailwind" copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css" -run "#{bundler_cmd} add tailwindcss@latest postcss@latest autoprefixer@latest" +run "#{bundler_cmd} add tailwindcss@latest @tailwindcss/cli@latest" say "Add build:css script" add_package_json_script "build:css", - "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify" + "#{bundler_x_cmd} @tailwindcss/cli -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify" diff --git a/lib/install/tailwind/package.json b/lib/install/tailwind/package.json index 32f598a..662b0f1 100644 --- a/lib/install/tailwind/package.json +++ b/lib/install/tailwind/package.json @@ -2,6 +2,6 @@ "name": "app", "private": "true", "scripts": { - "build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css" + "build:css": "npx @tailwindcss/cli -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css" } } diff --git a/lib/install/tailwind/tailwind.config.js b/lib/install/tailwind/tailwind.config.js deleted file mode 100644 index 4bca89f..0000000 --- a/lib/install/tailwind/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - content: [ - './app/views/**/*.html.erb', - './app/helpers/**/*.rb', - './app/assets/stylesheets/**/*.css', - './app/javascript/**/*.js' - ] -} From 393e7560e021ca330ffa4a4399e68984b306df15 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 24 Feb 2025 13:29:11 +0100 Subject: [PATCH 15/23] Bump version for 1.4.2 --- Gemfile.lock | 2 +- lib/cssbundling/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bbda716..29b8821 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cssbundling-rails (1.4.1) + cssbundling-rails (1.4.2) railties (>= 6.0.0) GEM diff --git a/lib/cssbundling/version.rb b/lib/cssbundling/version.rb index 72f5ad2..d46c887 100644 --- a/lib/cssbundling/version.rb +++ b/lib/cssbundling/version.rb @@ -1,3 +1,3 @@ module Cssbundling - VERSION = "1.4.1" + VERSION = "1.4.2" end From d39a8ccb87f1e643a54d2d2ae9557cc6357a53fa Mon Sep 17 00:00:00 2001 From: Meyric Rawlings Date: Mon, 3 Mar 2025 15:17:33 +0000 Subject: [PATCH 16/23] Fix install task typo (#167) * Update for Darwin 24 Mac OS 15 support in the Gemfile.lock. * Fix typo in install task description We are installing CSS dependencies. --- Gemfile.lock | 1 + lib/tasks/cssbundling/build.rake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 29b8821..ff34757 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,6 +199,7 @@ PLATFORMS arm64-darwin-20 arm64-darwin-21 arm64-darwin-22 + arm64-darwin-24 x86_64-darwin-20 x86_64-darwin-21 x86_64-linux diff --git a/lib/tasks/cssbundling/build.rake b/lib/tasks/cssbundling/build.rake index 8410147..277c26d 100644 --- a/lib/tasks/cssbundling/build.rake +++ b/lib/tasks/cssbundling/build.rake @@ -1,5 +1,5 @@ namespace :css do - desc "Install JavaScript dependencies" + desc "Install CSS dependencies" task :install do command = Cssbundling::Tasks.install_command unless system(command) From f40831353da887b2bb1e5d50d805da3c5dee453f Mon Sep 17 00:00:00 2001 From: Roman Klevtsov Date: Mon, 3 Mar 2025 18:18:50 +0300 Subject: [PATCH 17/23] Improve package manager detection for Bun 1.2 compatibility (#165) * Improve package manager detection for Bun compatibility - Add support for both old (bun.lockb) and new (bun.lock) Bun lock files - Handle Bun with Yarn compatibility mode (yarn.lock) - Simplify tool detection by introducing LOCK_FILES mapping - Combine command existence and lock file checks into single method This change ensures proper detection of Bun when using different versions or when running in Yarn compatibility mode (bun install --yarn). * keep old name of tool_exists? * fix case statement in cssbundling/build.rake * Make using_bun? detect bun.lockb or bun.lock or yarn.lock --- lib/install/helpers.rb | 4 ++- lib/tasks/cssbundling/build.rake | 44 ++++++++++++++++---------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lib/install/helpers.rb b/lib/install/helpers.rb index a2b9e6a..cf5b612 100644 --- a/lib/install/helpers.rb +++ b/lib/install/helpers.rb @@ -14,7 +14,9 @@ def bundler_x_cmd end def using_bun? - File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock')) + tool_exists?('bun') && (File.exist?('bun.lockb') || + File.exist?('bun.lock') || + File.exist?('yarn.lock')) end def tool_exists?(tool) diff --git a/lib/tasks/cssbundling/build.rake b/lib/tasks/cssbundling/build.rake index 277c26d..ddce5ab 100644 --- a/lib/tasks/cssbundling/build.rake +++ b/lib/tasks/cssbundling/build.rake @@ -21,42 +21,42 @@ module Cssbundling module Tasks extend self + LOCK_FILES = { + bun: %w[bun.lockb bun.lock yarn.lock], + yarn: %w[yarn.lock], + pnpm: %w[pnpm-lock.yaml], + npm: %w[package-lock.json] + } + def install_command - case tool - when :bun then "bun install" - when :yarn then "yarn install" - when :pnpm then "pnpm install" - when :npm then "npm install" + case + when using_tool?(:bun) then "bun install" + when using_tool?(:yarn) then "yarn install" + when using_tool?(:pnpm) then "pnpm install" + when using_tool?(:npm) then "npm install" else raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies" end end def build_command - case tool - when :bun then "bun run build:css" - when :yarn then "yarn build:css" - when :pnpm then "pnpm build:css" - when :npm then "npm run build:css" + case + when using_tool?(:bun) then "bun run build:css" + when using_tool?(:yarn) then "yarn build:css" + when using_tool?(:pnpm) then "pnpm build:css" + when using_tool?(:npm) then "npm run build:css" else raise "cssbundling-rails: No suitable tool found for building CSS" end end - def tool - case - when File.exist?('bun.lockb') then :bun - when File.exist?('yarn.lock') then :yarn - when File.exist?('pnpm-lock.yaml') then :pnpm - when File.exist?('package-lock.json') then :npm - when tool_exists?('bun') then :bun - when tool_exists?('yarn') then :yarn - when tool_exists?('pnpm') then :pnpm - when tool_exists?('npm') then :npm - end - end + private def tool_exists?(tool) system "command -v #{tool} > /dev/null" end + + def using_tool?(tool) + tool_exists?(tool) && LOCK_FILES[tool].any? { |file| File.exist?(file) } + end end end From e061000c7376479cc31dd80c5707b16f486cbedf Mon Sep 17 00:00:00 2001 From: Matt Rasband <2184696+mattrasband@users.noreply.github.com> Date: Mon, 3 Mar 2025 08:19:55 -0700 Subject: [PATCH 18/23] Fixes a couple minor issues with bootstrap: (#160) 1. The `bootstrap.min.js` doesn't include all the dependencies, and consequently does not work out of the box. Adding `@popperjs/core` isn't straightforward. 1. The asset path to the bootstrap/dist/js directory is added twice. While it does not seem to negatively impact things - it's cleaner to ensure it's done once. Co-authored-by: David Heinemeier Hansson --- Gemfile.lock | 1 + lib/install/bootstrap/install.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff34757..4957ecc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,6 +199,7 @@ PLATFORMS arm64-darwin-20 arm64-darwin-21 arm64-darwin-22 + arm64-darwin-23 arm64-darwin-24 x86_64-darwin-20 x86_64-darwin-21 diff --git a/lib/install/bootstrap/install.rb b/lib/install/bootstrap/install.rb index abf8e1d..f712775 100644 --- a/lib/install/bootstrap/install.rb +++ b/lib/install/bootstrap/install.rb @@ -23,15 +23,15 @@ if Rails.root.join("config/importmap.rb").exist? say "Pin Bootstrap" - append_to_file "config/importmap.rb", %(pin "bootstrap", to: "bootstrap.min.js"\n) + append_to_file "config/importmap.rb", %(pin "bootstrap", to: "bootstrap.bundle.min.js"\n) - inject_into_file "config/initializers/assets.rb", after: /.*Rails.application.config.assets.paths.*\n/ do + inject_into_file "config/initializers/assets.rb", after: /.*\/bootstrap-icons\/font.*\n/ do <<~RUBY Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js") RUBY end - append_to_file "config/initializers/assets.rb", %(Rails.application.config.assets.precompile << "bootstrap.min.js") + append_to_file "config/initializers/assets.rb", %(Rails.application.config.assets.precompile << "bootstrap.bundle.min.js") end add_package_json_script("build:css:compile", "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules") From 1332e42334a7ab08041262f49a4796cc6cd1d02f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Mar 2025 16:26:01 +0100 Subject: [PATCH 19/23] Only attempt to add application link tag on Rails versions prior to 8 (closes #161) --- lib/install/install.rb | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/install/install.rb b/lib/install/install.rb index 0e9129f..4e195ce 100644 --- a/lib/install/install.rb +++ b/lib/install/install.rb @@ -20,21 +20,23 @@ say "Remove app/assets/stylesheets/application.css so build output can take over" remove_file "app/assets/stylesheets/application.css" -if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist? - say "Add stylesheet link tag in application layout" - insert_into_file( - app_layout_path.to_s, - defined?(Turbo) ? - %(\n <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>) : - %(\n <%= stylesheet_link_tag "application" %>), - before: /\s*<\/head>/ - ) -else - say "Default application.html.erb is missing!", :red - if defined?(Turbo) - say %( Add <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> within the tag in your custom layout.) +if Rails::VERSION::MAJOR < 8 + if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist? + say "Add stylesheet link tag in application layout" + insert_into_file( + app_layout_path.to_s, + defined?(Turbo) ? + %(\n <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>) : + %(\n <%= stylesheet_link_tag "application" %>), + before: /\s*<\/head>/ + ) else - say %( Add <%= stylesheet_link_tag "application" %> within the tag in your custom layout.) + say "Default application.html.erb is missing!", :red + if defined?(Turbo) + say %( Add <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> within the tag in your custom layout.) + else + say %( Add <%= stylesheet_link_tag "application" %> within the tag in your custom layout.) + end end end From 30ceb83d86405b09ba5d366c5763e4d842f64012 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Mar 2025 16:27:54 +0100 Subject: [PATCH 20/23] We use .keep files (closes #159) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5413d03..40d04be 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Some CSS packages use new CSS features that are not supported by the default Sas ### Why do I get `application.css not in asset pipeline` in production? -A common issue is that your repository does not contain the output directory used by the build commands. You must have `app/assets/builds` available. Add the directory with a `.gitkeep` file, and you'll ensure it's available in production. +A common issue is that your repository does not contain the output directory used by the build commands. You must have `app/assets/builds` available. Add the directory with a `.keep` file, and you'll ensure it's available in production. ### How do I avoid `ActionView::Template::Error: Error: Function rgb is missing argument $green`? From 2394d3dc46973d5dde13940d357f5db3a9d39c5c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Mar 2025 16:29:31 +0100 Subject: [PATCH 21/23] Bump version for 1.4.3 --- lib/cssbundling/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cssbundling/version.rb b/lib/cssbundling/version.rb index d46c887..7524952 100644 --- a/lib/cssbundling/version.rb +++ b/lib/cssbundling/version.rb @@ -1,3 +1,3 @@ module Cssbundling - VERSION = "1.4.2" + VERSION = "1.4.3" end From 8eca54ba2d8d9aae8719a2cc230637c4f9a003c8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Mar 2025 16:33:00 +0100 Subject: [PATCH 22/23] Use latest Rails --- Gemfile | 2 +- Gemfile.lock | 294 +++++++++++++++++++++++++++++---------------------- 2 files changed, 170 insertions(+), 126 deletions(-) diff --git a/Gemfile b/Gemfile index 1487b97..38f79ad 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem's dependencies in importmap-rails.gemspec. gemspec -rails_version = ENV["RAILS_VERSION"] || "6.1.0" +rails_version = ENV["RAILS_VERSION"] || "8.0.1" gem "rails", "~> #{rails_version}" gem "sqlite3" diff --git a/Gemfile.lock b/Gemfile.lock index 4957ecc..7da5085 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,73 +1,88 @@ PATH remote: . specs: - cssbundling-rails (1.4.2) + cssbundling-rails (1.4.3) railties (>= 6.0.0) GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) - mail (>= 2.7.1) - actionmailer (6.1.7.8) - actionpack (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activesupport (= 6.1.7.8) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.8) - actionview (= 6.1.7.8) - activesupport (= 6.1.7.8) - rack (~> 2.0, >= 2.0.9) + zeitwerk (~> 2.6) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) + mail (>= 2.8.0) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.8) - actionpack (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.8) - activesupport (= 6.1.7.8) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.8) - activesupport (= 6.1.7.8) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) - activestorage (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activesupport (= 6.1.7.8) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) + timeout (>= 0.4.0) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.8) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (8.0.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) builder (3.3.0) byebug (11.1.3) capybara (3.40.0) @@ -79,15 +94,23 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) crass (1.0.6) - date (3.3.4) - erubi (1.13.0) + date (3.4.1) + drb (2.2.1) + erubi (1.13.1) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) - loofah (2.22.0) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + logger (1.6.6) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -97,119 +120,140 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - method_source (1.1.0) mini_mime (1.1.5) - minitest (5.24.1) - net-imap (0.4.14) + minitest (5.25.4) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.7-aarch64-linux) + nio4r (2.7.4) + nokogiri (1.18.3-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.3-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.3-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.3-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.3-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.3-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.3-x86_64-linux-musl) racc (~> 1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio public_suffix (6.0.1) - racc (1.8.0) - rack (2.2.9) - rack-test (2.1.0) + racc (1.8.1) + rack (3.1.10) + rack-session (2.1.0) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rails (6.1.7.8) - actioncable (= 6.1.7.8) - actionmailbox (= 6.1.7.8) - actionmailer (= 6.1.7.8) - actionpack (= 6.1.7.8) - actiontext (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activemodel (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + rackup (2.2.1) + rack (>= 3) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 6.1.7.8) - sprockets-rails (>= 2.0.0) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) - method_source + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rake (13.2.1) - regexp_parser (2.9.2) - rexml (3.3.2) - strscan - rubyzip (2.3.2) + rdoc (6.12.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.1) + rubyzip (2.4.1) + securerandom (0.4.1) selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) - actionpack (>= 6.1) - activesupport (>= 6.1) - sprockets (>= 3.0.0) - sqlite3 (2.0.2-aarch64-linux-gnu) - sqlite3 (2.0.2-arm64-darwin) - sqlite3 (2.0.2-x86_64-darwin) - sqlite3 (2.0.2-x86_64-linux-gnu) - stimulus-rails (1.3.3) - railties (>= 6.0.0) - strscan (3.1.0) - thor (1.3.1) - timeout (0.4.1) - turbo-rails (2.0.6) - actionpack (>= 6.0.0) - activejob (>= 6.0.0) + sqlite3 (2.6.0-aarch64-linux-gnu) + sqlite3 (2.6.0-aarch64-linux-musl) + sqlite3 (2.6.0-arm-linux-gnu) + sqlite3 (2.6.0-arm-linux-musl) + sqlite3 (2.6.0-arm64-darwin) + sqlite3 (2.6.0-x86_64-darwin) + sqlite3 (2.6.0-x86_64-linux-gnu) + sqlite3 (2.6.0-x86_64-linux-musl) + stimulus-rails (1.3.4) railties (>= 6.0.0) + stringio (3.1.5) + thor (1.3.2) + timeout (0.4.3) + turbo-rails (2.0.13) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + uri (1.0.3) + useragent (0.16.11) webdrivers (5.3.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0, < 4.11) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.7.2) PLATFORMS - aarch64-linux - arm64-darwin-20 - arm64-darwin-21 - arm64-darwin-22 - arm64-darwin-23 - arm64-darwin-24 - x86_64-darwin-20 - x86_64-darwin-21 - x86_64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES byebug capybara cssbundling-rails! - rails (~> 6.1.0) + rails (~> 8.0.1) rexml selenium-webdriver sqlite3 @@ -218,4 +262,4 @@ DEPENDENCIES webdrivers BUNDLED WITH - 2.2.33 + 2.6.2 From 95d9b59133d84e4fe1fc6455d3d100dde9567d51 Mon Sep 17 00:00:00 2001 From: Masumi Kawasaki Date: Sat, 12 Apr 2025 19:39:58 +0900 Subject: [PATCH 23/23] Update Bulma template: Utilize `@use` and `@forward` Directives for Modular Importing (#173) - Replaced outdated `@import` statements with `@use` and `@forward` for improved SCSS modularity. --- lib/install/bulma/application.bulma.scss | 75 ++++++++++++------------ 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/lib/install/bulma/application.bulma.scss b/lib/install/bulma/application.bulma.scss index b0bc1ad..76c177e 100644 --- a/lib/install/bulma/application.bulma.scss +++ b/lib/install/bulma/application.bulma.scss @@ -1,39 +1,42 @@ -// @charset "utf-8"; - -// Import a Google Font -// @import url('https://fonts.googleapis.com/css?family=Nunito:400,700'); - // Set your brand colors -// $purple: #8A4D76; -// $pink: #FA7C91; +// $purple: #8a4d76; +// $pink: #fa7c91; // $brown: #757763; -// $beige-light: #D0D1CD; -// $beige-lighter: #EFF0EB; - -// Update Bulma's global variables -// $family-sans-serif: "Nunito", sans-serif; -// $grey-dark: $brown; -// $grey-light: $beige-light; -// $primary: $purple; -// $link: $pink; -// $widescreen-enabled: false; -// $fullhd-enabled: false; - -// Update some of Bulma's component variables -// $body-background-color: $beige-lighter; -// $control-border-width: 2px; -// $input-border-color: transparent; -// $input-shadow: none; - -// Import only what you need from Bulma -// @import "bulma/sass/utilities/_all.sass"; -// @import "bulma/sass/base/_all.sass"; -// @import "bulma/sass/elements/button.sass"; -// @import "bulma/sass/elements/container.sass"; -// @import "bulma/sass/elements/title.sass"; -// @import "bulma/sass/form/_all.sass"; -// @import "bulma/sass/components/navbar.sass"; -// @import "bulma/sass/layout/hero.sass"; -// @import "bulma/sass/layout/section.sass"; +// $beige-light: #d0d1cd; +// $beige-lighter: #eff0eb; +// +// Override global Sass variables from the /utilities folder +// @use "bulma/sass/utilities" with ( +// $family-primary: '"Nunito", sans-serif', +// $grey-dark: $brown, +// $grey-light: $beige-light, +// $primary: $purple, +// $link: $pink, +// $control-border-width: 2px +// ); +// +// Override Sass variables from the /form folder +// @use "bulma/sass/form" with ( +// $input-shadow: none +// ); +// +// Import the components you need +// @forward "bulma/sass/base"; +// @forward "bulma/sass/components/card"; +// @forward "bulma/sass/components/modal"; +// @forward "bulma/sass/components/navbar"; +// @forward "bulma/sass/elements/button"; +// @forward "bulma/sass/elements/icon"; +// @forward "bulma/sass/elements/content"; +// @forward "bulma/sass/elements/notification"; +// @forward "bulma/sass/elements/progress"; +// @forward "bulma/sass/elements/tag"; +// @forward "bulma/sass/layout/footer"; +// +// Import the themes so that all CSS variables have a value +// @forward "bulma/sass/themes"; +// +// Import the Google Font +// @import url("https://fonts.googleapis.com/css?family=Nunito:400,700"); -@import 'bulma/bulma'; +@use 'bulma/bulma';