Skip to content

Commit 11a8f37

Browse files
authored
Don't enhance test:prepare unless it exists (#9)
* Don't enhance test:prepare unless it exists * Document need to run css:build before test suite when test:prepare is not defined
1 parent efc2bfa commit 11a8f37

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ When you deploy your application to production, the `css:build` task attaches to
88

99
This also happens in testing where the bundler attaches to the `test:prepare` task to ensure the stylesheets have been bundled before testing commences. (Note that this currently only applies to rails `test:*` tasks (like `test:all` or `test:controllers`), not "rails test", as that doesn't load `test:prepare`).
1010

11+
If your test framework does not define a `test:prepare` Rake task, ensure that your test framework runs `css:build` to bundle stylesheets before testing commences.
12+
1113
That's it!
1214

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

lib/tasks/cssbundling/build.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ namespace :css do
66
end
77

88
Rake::Task["assets:precompile"].enhance(["css:build"])
9-
Rake::Task["test:prepare"].enhance(["css:build"])
9+
Rake::Task["test:prepare"].enhance(["css:build"]) if Rake::Task.task_defined?("test:prepare")

0 commit comments

Comments
 (0)