Skip to content

Fix read-only file system issue #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
<!-- toc -->

- [Installation](#installation)
* [Choosing a specific version of `tailwindcss`](#choosing-a-specific-version-of-tailwindcss)
* [Using a local installation of `tailwindcss`](#using-a-local-installation-of-tailwindcss)
- [Choosing a specific version of `tailwindcss`](#choosing-a-specific-version-of-tailwindcss)
- [Using a local installation of `tailwindcss`](#using-a-local-installation-of-tailwindcss)
- [Upgrading your application from Tailwind v3 to v4](#upgrading-your-application-from-tailwind-v3-to-v4)
* [You don't _have_ to upgrade](#you-dont-_have_-to-upgrade)
* [Upgrade steps](#upgrade-steps)
* [Troubleshooting a v4 upgrade](#troubleshooting-a-v4-upgrade)
* [Updating CSS class names for v4](#updating-css-class-names-for-v4)
- [You don't _have_ to upgrade](#you-dont-_have_-to-upgrade)
- [Upgrade steps](#upgrade-steps)
- [Troubleshooting a v4 upgrade](#troubleshooting-a-v4-upgrade)
- [Updating CSS class names for v4](#updating-css-class-names-for-v4)
- [Developing with Tailwindcss](#developing-with-tailwindcss)
* [Configuration and commands](#configuration-and-commands)
* [Building for production](#building-for-production)
* [Building for testing](#building-for-testing)
* [Building unminified assets](#building-unminified-assets)
* [Live rebuild](#live-rebuild)
* [Using Tailwind plugins](#using-tailwind-plugins)
* [Using with PostCSS](#using-with-postcss)
* [Custom inputs or outputs](#custom-inputs-or-outputs)
* [Rails Engines support (Experimental)](#rails-engines-support-experimental)
- [Configuration and commands](#configuration-and-commands)
- [Building for production](#building-for-production)
- [Building for testing](#building-for-testing)
- [Building unminified assets](#building-unminified-assets)
- [Live rebuild](#live-rebuild)
- [Using Tailwind plugins](#using-tailwind-plugins)
- [Using with PostCSS](#using-with-postcss)
- [Custom inputs or outputs](#custom-inputs-or-outputs)
- [Rails Engines support (Experimental)](#rails-engines-support-experimental)
- [Troubleshooting](#troubleshooting)
* [The `watch` command is hanging](#the-watch-command-is-hanging)
* [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)
* [Running in a docker container exits prematurely](#running-in-a-docker-container-exits-prematurely)
* [Conflict with sassc-rails](#conflict-with-sassc-rails)
* [Class names must be spelled out](#class-names-must-be-spelled-out)
* [`ERROR: Cannot find the tailwindcss executable` for supported platform](#error-cannot-find-the-tailwindcss-executable-for-supported-platform)
* [Using asset-pipeline assets](#using-asset-pipeline-assets)
- [The `watch` command is hanging](#the-watch-command-is-hanging)
- [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)
- [Running in a docker container exits prematurely](#running-in-a-docker-container-exits-prematurely)
- [Conflict with sassc-rails](#conflict-with-sassc-rails)
- [Class names must be spelled out](#class-names-must-be-spelled-out)
- [`ERROR: Cannot find the tailwindcss executable` for supported platform](#error-cannot-find-the-tailwindcss-executable-for-supported-platform)
- [Using asset-pipeline assets](#using-asset-pipeline-assets)
- [License](#license)

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

```ruby
# Gemfile
# Gemfile
gem "tailwindcss-rails", "~> 4.0" # which transitively pins tailwindcss-ruby to v4
```

Expand Down Expand Up @@ -392,7 +392,7 @@ If you need to use a custom input or output file, you can run `bundle exec tailw

_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)._

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` 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.
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.

> [!IMPORTANT]
> 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.
Expand Down
4 changes: 0 additions & 4 deletions lib/tailwindcss/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ class Engine < ::Rails::Engine
config.app_generators do |g|
g.template_engine :tailwindcss
end

config.after_initialize do
Tailwindcss::Engines.bundle
end
end
end
9 changes: 9 additions & 0 deletions lib/tasks/build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace :tailwindcss do
debug = args.extras.include?("debug")
verbose = args.extras.include?("verbose")


command = Tailwindcss::Commands.compile_command(debug: debug)
env = Tailwindcss::Commands.command_env(verbose: verbose)
puts "Running: #{Shellwords.join(command)}" if verbose
Expand All @@ -26,8 +27,16 @@ namespace :tailwindcss do
rescue Interrupt
puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
end

desc "Create Rails Engines entry points"
task engines: :environment do
Tailwindcss::Engines.bundle
end
end

Rake::Task["tailwindcss:build"].enhance(["tailwindcss:engines"])
Rake::Task["tailwindcss:watch"].enhance(["tailwindcss:engines"])

Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])

if Rake::Task.task_defined?("test:prepare")
Expand Down
Loading