cssbundling-rails 1.4.1 → 1.4.2

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: a644c7ba1cafbe1174c0c1fec2cbc9b545e1fc9e620d9c9e348c9cd58f2477a9
4
- data.tar.gz: 756402251b7446a021598edcbd26b24fd6e89be36aeeb0f42592febabe5d336a
3
+ metadata.gz: a66c0e0cc7f1112643a6c720f3f44ad0cd5f755bcf041a20c457b85dcc1d4399
4
+ data.tar.gz: 583f803ecef9faf25ae086b134124bee3f20bf518fb3134c376ec07e214c60f2
5
5
  SHA512:
6
- metadata.gz: 63e4c7932449cf676e20d0f3d6510c653ecf1e90aa1fdabae9a5f43b4edb41ee6e8697ce12cff1b1debd2a0d410356ffeec141fe1032b2015edb689e1c6a8920
7
- data.tar.gz: b0abcc8f73a13d588066195646989b2218c5a7bd3d9d85344ae1802136ddfa3f660eca75af03835f5af4f75f0c9ea87d026dbbd99efbc4a1b12104d374d6689a
6
+ metadata.gz: bf563e95e2d5bb3649fd863ad960b8442cad65283671bb2546f43cd35e0f26000ae99b4495c5b665aad99c8051be1a69cf4a4c6706afc9506aba93691ff8ac7f
7
+ data.tar.gz: fb26b6ec28b4d8e87f8e2df215da00c923f7601c7d5112a4486af99241347f6ab2cbe0f02292f991270faa2813fd81ed82a932658c6522a3881e86169f006ec7
data/README.md CHANGED
@@ -12,8 +12,7 @@ This also happens in testing where the bundler attaches to the `test:prepare` ta
12
12
 
13
13
  That's it!
14
14
 
15
- 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.
16
-
15
+ You can configure your bundler options in the `build:css` script in `package.json` or `postcss.config.js` for PostCSS.
17
16
 
18
17
  ## Installation
19
18
 
@@ -22,8 +21,7 @@ You must already have node and yarn installed on your system. You will also need
22
21
  1. Run `./bin/bundle add cssbundling-rails`
23
22
  2. Run `./bin/rails css:install:[tailwind|bootstrap|bulma|postcss|sass]`
24
23
 
25
- 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]`.
26
-
24
+ 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]`.
27
25
 
28
26
  ## FAQ
29
27
 
@@ -31,9 +29,17 @@ Or, in Rails 7+, you can preconfigure your new application to use a specific bun
31
29
 
32
30
  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.
33
31
 
32
+ In Rails 7+, you can preconfigure your new application to use `tailwindcss-rails` and `dartsass-rails` with `rails new myapp --css [tailwind|sass]`.
33
+
34
34
  ### How do I import relative CSS files with Tailwind?
35
35
 
36
- 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" %>`.
36
+ 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:
37
+
38
+ ```erb
39
+ <%= stylesheet_link_tag "application", "other", "styles", "data-turbo-track": "reload" %>
40
+ ```
41
+
42
+ This ensures your files are properly linked and ready to use.
37
43
 
38
44
  ### How do I avoid SassC::SyntaxError exceptions on existing projects?
39
45
 
@@ -57,7 +63,7 @@ Rails.application.config.assets.css_compressor = nil
57
63
  Watch out - if you precompile your files locally, those will be served over the dynamically created ones you expect. The solution:
58
64
 
59
65
  ```shell
60
- rails assets:clobber
66
+ rails assets:clobber
61
67
  ```
62
68
 
63
69
  ### How do I include 3rd party stylesheets from `node_modules` in my bundle?
@@ -1,3 +1,3 @@
1
1
  module Cssbundling
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
@@ -9,6 +9,10 @@ module Helpers
9
9
  using_bun? ? "bun run" : "yarn"
10
10
  end
11
11
 
12
+ def bundler_x_cmd
13
+ using_bun? ? "bunx" : "npx"
14
+ end
15
+
12
16
  def using_bun?
13
17
  File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
14
18
  end
@@ -1,3 +1 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @import "tailwindcss";
@@ -3,11 +3,10 @@ self.extend Helpers
3
3
 
4
4
  apply "#{__dir__}/../install.rb"
5
5
 
6
- say "Install Tailwind (+PostCSS w/ autoprefixer)"
7
- copy_file "#{__dir__}/tailwind.config.js", "tailwind.config.js"
6
+ say "Install Tailwind"
8
7
  copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css"
9
- run "#{bundler_cmd} add tailwindcss@latest postcss@latest autoprefixer@latest"
8
+ run "#{bundler_cmd} add tailwindcss@latest @tailwindcss/cli@latest"
10
9
 
11
10
  say "Add build:css script"
12
11
  add_package_json_script "build:css",
13
- "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
12
+ "#{bundler_x_cmd} @tailwindcss/cli -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
@@ -2,6 +2,6 @@
2
2
  "name": "app",
3
3
  "private": "true",
4
4
  "scripts": {
5
- "build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css"
5
+ "build:css": "npx @tailwindcss/cli -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css"
6
6
  }
7
7
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cssbundling-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-29 00:00:00.000000000 Z
12
+ date: 2025-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -54,7 +54,6 @@ files:
54
54
  - lib/install/tailwind/application.tailwind.css
55
55
  - lib/install/tailwind/install.rb
56
56
  - lib/install/tailwind/package.json
57
- - lib/install/tailwind/tailwind.config.js
58
57
  - lib/tasks/cssbundling/build.rake
59
58
  - lib/tasks/cssbundling/clobber.rake
60
59
  - lib/tasks/cssbundling/install.rake
@@ -78,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
77
  - !ruby/object:Gem::Version
79
78
  version: '0'
80
79
  requirements: []
81
- rubygems_version: 3.5.11
80
+ rubygems_version: 3.5.22
82
81
  signing_key:
83
82
  specification_version: 4
84
83
  summary: Bundle and process CSS with Tailwind, Bootstrap, PostCSS, Sass in Rails via
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- content: [
3
- './app/views/**/*.html.erb',
4
- './app/helpers/**/*.rb',
5
- './app/assets/stylesheets/**/*.css',
6
- './app/javascript/**/*.js'
7
- ]
8
- }