Skip to content

Commit ae80de9

Browse files
committed
Changes due to review
1 parent 5437db5 commit ae80de9

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@
77
<!-- toc -->
88

99
- [Installation](#installation)
10-
* [Choosing a specific version of `tailwindcss`](#choosing-a-specific-version-of-tailwindcss)
11-
* [Using a local installation of `tailwindcss`](#using-a-local-installation-of-tailwindcss)
10+
- [Choosing a specific version of `tailwindcss`](#choosing-a-specific-version-of-tailwindcss)
11+
- [Using a local installation of `tailwindcss`](#using-a-local-installation-of-tailwindcss)
1212
- [Upgrading your application from Tailwind v3 to v4](#upgrading-your-application-from-tailwind-v3-to-v4)
13-
* [You don't _have_ to upgrade](#you-dont-_have_-to-upgrade)
14-
* [Upgrade steps](#upgrade-steps)
15-
* [Troubleshooting a v4 upgrade](#troubleshooting-a-v4-upgrade)
16-
* [Updating CSS class names for v4](#updating-css-class-names-for-v4)
13+
- [You don't _have_ to upgrade](#you-dont-_have_-to-upgrade)
14+
- [Upgrade steps](#upgrade-steps)
15+
- [Troubleshooting a v4 upgrade](#troubleshooting-a-v4-upgrade)
16+
- [Updating CSS class names for v4](#updating-css-class-names-for-v4)
1717
- [Developing with Tailwindcss](#developing-with-tailwindcss)
18-
* [Configuration and commands](#configuration-and-commands)
19-
* [Building for production](#building-for-production)
20-
* [Building for testing](#building-for-testing)
21-
* [Building unminified assets](#building-unminified-assets)
22-
* [Live rebuild](#live-rebuild)
23-
* [Using Tailwind plugins](#using-tailwind-plugins)
24-
* [Using with PostCSS](#using-with-postcss)
25-
* [Custom inputs or outputs](#custom-inputs-or-outputs)
26-
* [Rails Engines support (Experimental)](#rails-engines-support-experimental)
18+
- [Configuration and commands](#configuration-and-commands)
19+
- [Building for production](#building-for-production)
20+
- [Building for testing](#building-for-testing)
21+
- [Building unminified assets](#building-unminified-assets)
22+
- [Live rebuild](#live-rebuild)
23+
- [Using Tailwind plugins](#using-tailwind-plugins)
24+
- [Using with PostCSS](#using-with-postcss)
25+
- [Custom inputs or outputs](#custom-inputs-or-outputs)
26+
- [Rails Engines support (Experimental)](#rails-engines-support-experimental)
2727
- [Troubleshooting](#troubleshooting)
28-
* [The `watch` command is hanging](#the-watch-command-is-hanging)
29-
* [Lost keystrokes or hanging when using terminal-based debugging tools (e.g. IRB, Pry, `ruby/debug`...etc.) with the Puma plugin](#lost-keystrokes-or-hanging-when-using-terminal-based-debugging-tools-eg-irb-pry-rubydebugetc-with-the-puma-plugin)
30-
* [Running in a docker container exits prematurely](#running-in-a-docker-container-exits-prematurely)
31-
* [Conflict with sassc-rails](#conflict-with-sassc-rails)
32-
* [Class names must be spelled out](#class-names-must-be-spelled-out)
33-
* [`ERROR: Cannot find the tailwindcss executable` for supported platform](#error-cannot-find-the-tailwindcss-executable-for-supported-platform)
34-
* [Using asset-pipeline assets](#using-asset-pipeline-assets)
28+
- [The `watch` command is hanging](#the-watch-command-is-hanging)
29+
- [Lost keystrokes or hanging when using terminal-based debugging tools (e.g. IRB, Pry, `ruby/debug`...etc.) with the Puma plugin](#lost-keystrokes-or-hanging-when-using-terminal-based-debugging-tools-eg-irb-pry-rubydebugetc-with-the-puma-plugin)
30+
- [Running in a docker container exits prematurely](#running-in-a-docker-container-exits-prematurely)
31+
- [Conflict with sassc-rails](#conflict-with-sassc-rails)
32+
- [Class names must be spelled out](#class-names-must-be-spelled-out)
33+
- [`ERROR: Cannot find the tailwindcss executable` for supported platform](#error-cannot-find-the-tailwindcss-executable-for-supported-platform)
34+
- [Using asset-pipeline assets](#using-asset-pipeline-assets)
3535
- [License](#license)
3636

3737
<!-- tocstop -->
@@ -99,7 +99,7 @@ gem "tailwindcss-ruby", "~> 3.4" # only necessary with tailwindcss-rails <= 3.3.
9999
First, update to `tailwindcss-rails` v4.0.0 or higher. This will also ensure you're transitively depending on `tailwindcss-ruby` v4.
100100

101101
```ruby
102-
# Gemfile
102+
# Gemfile
103103
gem "tailwindcss-rails", "~> 4.0" # which transitively pins tailwindcss-ruby to v4
104104
```
105105

@@ -392,7 +392,7 @@ If you need to use a custom input or output file, you can run `bundle exec tailw
392392
393393
_This feature is experimental and may change in the future. If you have feedback, please join the [discussion](https://github.com/rails/tailwindcss-rails/discussions/355)._
394394
395-
If you have Rails Engines in your application that use Tailwind CSS and provide an `app/assets/tailwind/<engine_name>/engine.css` file, entry point files will be created for each of them in `app/assets/builds/tailwind/<engine_name>.css` on the first build/watch invocation so they can be included in your host application's Tailwind CSS by adding `@import "../builds/tailwind/<engine_name>"` to your `app/assets/tailwind/application.css` file.
395+
If you have Rails Engines in your application that use Tailwind CSS and provide an `app/assets/tailwind/<engine_name>/engine.css` file, entry point files will be created for each of them in `app/assets/builds/tailwind/<engine_name>.css` on the first build/watch invocation or manual call for `rails tailwindcss:engines` so they can be included in your host application's Tailwind CSS by adding `@import "../builds/tailwind/<engine_name>"` to your `app/assets/tailwind/application.css` file.
396396
397397
> [!IMPORTANT]
398398
> You must `@import` the engine CSS files in your `app/assets/tailwind/application.css` for the engine to be included in the build. By default, no engine CSS files are imported, and you must opt-in to using the file in your build.

lib/tasks/build.rake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace :tailwindcss do
44
debug = args.extras.include?("debug")
55
verbose = args.extras.include?("verbose")
66

7-
Tailwindcss::Engines.bundle
7+
88
command = Tailwindcss::Commands.compile_command(debug: debug)
99
env = Tailwindcss::Commands.command_env(verbose: verbose)
1010
puts "Running: #{Shellwords.join(command)}" if verbose
@@ -19,7 +19,6 @@ namespace :tailwindcss do
1919
always = args.extras.include?("always")
2020
verbose = args.extras.include?("verbose")
2121

22-
Tailwindcss::Engines.bundle
2322
command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
2423
env = Tailwindcss::Commands.command_env(verbose: verbose)
2524
puts "Running: #{Shellwords.join(command)}" if verbose
@@ -28,8 +27,16 @@ namespace :tailwindcss do
2827
rescue Interrupt
2928
puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
3029
end
30+
31+
desc "Create Rails Engines entry points"
32+
task engines: :environment do
33+
Tailwindcss::Engines.bundle
34+
end
3135
end
3236

37+
Rake::Task["tailwindcss:build"].enhance(["tailwindcss:engines"])
38+
Rake::Task["tailwindcss:watch"].enhance(["tailwindcss:engines"])
39+
3340
Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])
3441

3542
if Rake::Task.task_defined?("test:prepare")

0 commit comments

Comments
 (0)