Skip to content

Don't enhance test:prepare unless it exists #9

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 2 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ When you deploy your application to production, the `css:build` task attaches to

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

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.

That's it!

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.
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/cssbundling/build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace :css do
end

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