cssbundling-rails 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66c0e0cc7f1112643a6c720f3f44ad0cd5f755bcf041a20c457b85dcc1d4399
4
- data.tar.gz: 583f803ecef9faf25ae086b134124bee3f20bf518fb3134c376ec07e214c60f2
3
+ metadata.gz: 319fde756ef3f014dc55f2e3c826e8420d7a294c1284b7858d7195f4df3263f2
4
+ data.tar.gz: 22855d55faabba57015601f580c548eef162d8ff34f364ea0290bd46c2c04b86
5
5
  SHA512:
6
- metadata.gz: bf563e95e2d5bb3649fd863ad960b8442cad65283671bb2546f43cd35e0f26000ae99b4495c5b665aad99c8051be1a69cf4a4c6706afc9506aba93691ff8ac7f
7
- data.tar.gz: fb26b6ec28b4d8e87f8e2df215da00c923f7601c7d5112a4486af99241347f6ab2cbe0f02292f991270faa2813fd81ed82a932658c6522a3881e86169f006ec7
6
+ metadata.gz: 88081e41b62f0e7b58f729d82f865d7b1557c1628de598aa2f96327d4be0277720e5c79a4657ac52f7b9a833d4ef78c9896d392cebe12b37024be2dccb4be4f3
7
+ data.tar.gz: 22ce728830cd4be3ad30cba5d9066b9dfba630dfa21aa677959a28e2d86999efd7996898d88e62af9e904de3c312da1bc4368ca0b97137c637fa8ac5cb9a19e8
data/README.md CHANGED
@@ -47,7 +47,7 @@ Some CSS packages use new CSS features that are not supported by the default Sas
47
47
 
48
48
  ### Why do I get `application.css not in asset pipeline` in production?
49
49
 
50
- 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.
50
+ 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.
51
51
 
52
52
  ### How do I avoid `ActionView::Template::Error: Error: Function rgb is missing argument $green`?
53
53
 
@@ -1,3 +1,3 @@
1
1
  module Cssbundling
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
@@ -23,15 +23,15 @@ end
23
23
 
24
24
  if Rails.root.join("config/importmap.rb").exist?
25
25
  say "Pin Bootstrap"
26
- append_to_file "config/importmap.rb", %(pin "bootstrap", to: "bootstrap.min.js"\n)
26
+ append_to_file "config/importmap.rb", %(pin "bootstrap", to: "bootstrap.bundle.min.js"\n)
27
27
 
28
- inject_into_file "config/initializers/assets.rb", after: /.*Rails.application.config.assets.paths.*\n/ do
28
+ inject_into_file "config/initializers/assets.rb", after: /.*\/bootstrap-icons\/font.*\n/ do
29
29
  <<~RUBY
30
30
  Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js")
31
31
  RUBY
32
32
  end
33
33
 
34
- append_to_file "config/initializers/assets.rb", %(Rails.application.config.assets.precompile << "bootstrap.min.js")
34
+ append_to_file "config/initializers/assets.rb", %(Rails.application.config.assets.precompile << "bootstrap.bundle.min.js")
35
35
  end
36
36
 
37
37
  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")
@@ -14,7 +14,9 @@ module Helpers
14
14
  end
15
15
 
16
16
  def using_bun?
17
- File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
17
+ tool_exists?('bun') && (File.exist?('bun.lockb') ||
18
+ File.exist?('bun.lock') ||
19
+ File.exist?('yarn.lock'))
18
20
  end
19
21
 
20
22
  def tool_exists?(tool)
@@ -20,21 +20,23 @@ end
20
20
  say "Remove app/assets/stylesheets/application.css so build output can take over"
21
21
  remove_file "app/assets/stylesheets/application.css"
22
22
 
23
- if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
24
- say "Add stylesheet link tag in application layout"
25
- insert_into_file(
26
- app_layout_path.to_s,
27
- defined?(Turbo) ?
28
- %(\n <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>) :
29
- %(\n <%= stylesheet_link_tag "application" %>),
30
- before: /\s*<\/head>/
31
- )
32
- else
33
- say "Default application.html.erb is missing!", :red
34
- if defined?(Turbo)
35
- say %( Add <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
23
+ if Rails::VERSION::MAJOR < 8
24
+ if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
25
+ say "Add stylesheet link tag in application layout"
26
+ insert_into_file(
27
+ app_layout_path.to_s,
28
+ defined?(Turbo) ?
29
+ %(\n <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>) :
30
+ %(\n <%= stylesheet_link_tag "application" %>),
31
+ before: /\s*<\/head>/
32
+ )
36
33
  else
37
- say %( Add <%= stylesheet_link_tag "application" %> within the <head> tag in your custom layout.)
34
+ say "Default application.html.erb is missing!", :red
35
+ if defined?(Turbo)
36
+ say %( Add <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
37
+ else
38
+ say %( Add <%= stylesheet_link_tag "application" %> within the <head> tag in your custom layout.)
39
+ end
38
40
  end
39
41
  end
40
42
 
@@ -1,5 +1,5 @@
1
1
  namespace :css do
2
- desc "Install JavaScript dependencies"
2
+ desc "Install CSS dependencies"
3
3
  task :install do
4
4
  command = Cssbundling::Tasks.install_command
5
5
  unless system(command)
@@ -21,42 +21,42 @@ module Cssbundling
21
21
  module Tasks
22
22
  extend self
23
23
 
24
+ LOCK_FILES = {
25
+ bun: %w[bun.lockb bun.lock yarn.lock],
26
+ yarn: %w[yarn.lock],
27
+ pnpm: %w[pnpm-lock.yaml],
28
+ npm: %w[package-lock.json]
29
+ }
30
+
24
31
  def install_command
25
- case tool
26
- when :bun then "bun install"
27
- when :yarn then "yarn install"
28
- when :pnpm then "pnpm install"
29
- when :npm then "npm install"
32
+ case
33
+ when using_tool?(:bun) then "bun install"
34
+ when using_tool?(:yarn) then "yarn install"
35
+ when using_tool?(:pnpm) then "pnpm install"
36
+ when using_tool?(:npm) then "npm install"
30
37
  else raise "cssbundling-rails: No suitable tool found for installing JavaScript dependencies"
31
38
  end
32
39
  end
33
40
 
34
41
  def build_command
35
- case tool
36
- when :bun then "bun run build:css"
37
- when :yarn then "yarn build:css"
38
- when :pnpm then "pnpm build:css"
39
- when :npm then "npm run build:css"
42
+ case
43
+ when using_tool?(:bun) then "bun run build:css"
44
+ when using_tool?(:yarn) then "yarn build:css"
45
+ when using_tool?(:pnpm) then "pnpm build:css"
46
+ when using_tool?(:npm) then "npm run build:css"
40
47
  else raise "cssbundling-rails: No suitable tool found for building CSS"
41
48
  end
42
49
  end
43
50
 
44
- def tool
45
- case
46
- when File.exist?('bun.lockb') then :bun
47
- when File.exist?('yarn.lock') then :yarn
48
- when File.exist?('pnpm-lock.yaml') then :pnpm
49
- when File.exist?('package-lock.json') then :npm
50
- when tool_exists?('bun') then :bun
51
- when tool_exists?('yarn') then :yarn
52
- when tool_exists?('pnpm') then :pnpm
53
- when tool_exists?('npm') then :npm
54
- end
55
- end
51
+ private
56
52
 
57
53
  def tool_exists?(tool)
58
54
  system "command -v #{tool} > /dev/null"
59
55
  end
56
+
57
+ def using_tool?(tool)
58
+ tool_exists?(tool) && LOCK_FILES[tool].any? { |file| File.exist?(file) }
59
+ end
60
60
  end
61
61
  end
62
62
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cssbundling-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  - Dom Christie
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-02-24 00:00:00.000000000 Z
11
+ date: 2025-03-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
@@ -25,7 +24,6 @@ dependencies:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  version: 6.0.0
28
- description:
29
27
  email: david@loudthinking.com
30
28
  executables: []
31
29
  extensions: []
@@ -62,7 +60,6 @@ licenses:
62
60
  - MIT
63
61
  metadata:
64
62
  changelog_uri: https://github.com/rails/cssbundling-rails/releases
65
- post_install_message:
66
63
  rdoc_options: []
67
64
  require_paths:
68
65
  - lib
@@ -77,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
74
  - !ruby/object:Gem::Version
78
75
  version: '0'
79
76
  requirements: []
80
- rubygems_version: 3.5.22
81
- signing_key:
77
+ rubygems_version: 3.6.2
82
78
  specification_version: 4
83
79
  summary: Bundle and process CSS with Tailwind, Bootstrap, PostCSS, Sass in Rails via
84
80
  Node.js.