Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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 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
2 changes: 2 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")

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

Tailwindcss::Engines.bundle
command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
env = Tailwindcss::Commands.command_env(verbose: verbose)
puts "Running: #{Shellwords.join(command)}" if verbose
Expand Down
Loading