Skip to content

Commit a253d67

Browse files
committed
Rename to engine.css
1 parent 430e611 commit a253d67

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,10 @@ Then you can use yarn or npm to install the dependencies.
386386
387387
### Rails Engines support
388388
389-
If you have Rails Engines in your application that use Tailwind CSS and provide an `app/assets/tailwind/<engine_name>/application.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 "../../assets/builds/tailwind/<engine_name>"` to your `app/assets/tailwind/application.css` file.
389+
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 "../../assets/builds/tailwind/<engine_name>"` to your `app/assets/tailwind/application.css` file.
390+
391+
> [!IMPORTANT]
392+
> Only imported in `app/assets/tailwind/application.css` engine CSS files will be included in the build. By default, no engine CSS files are imported. This give you flexibility on which engine CSS files you want to include in your build.
390393
391394
### Custom inputs or outputs
392395

lib/tailwindcss/engines.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ class << self
44
def bundle
55
FileUtils.mkdir_p(Rails.root.join("app/assets/builds/tailwind"))
66
Rails::Engine.subclasses.select do |engine|
7-
engine.root.join("app/assets/tailwind/#{engine.engine_name}/application.css").exist?
7+
engine.root.join("app/assets/tailwind/#{engine.engine_name}/engine.css").exist?
88
end.each do |engine|
99
file_path = Rails.root.join("app/assets/builds/tailwind/#{engine.engine_name}.css")
1010
FileUtils.rm(file_path) if File.exist?(file_path)
1111
template = <<~TEMPLATE
1212
/* DO NOT MODIFY THIS FILE, it was auto-generated by tailwindcss-rails */
1313
14-
@import "#{engine.root.join("app/assets/tailwind/#{engine.engine_name}/application.css")}";
14+
@import "#{engine.root.join("app/assets/tailwind/#{engine.engine_name}/engine.css")}";
1515
TEMPLATE
1616
File.open(file_path, 'w') do |file|
1717
file.puts template

0 commit comments

Comments
 (0)