Skip to content
Closed
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
5 changes: 3 additions & 2 deletions packages/tailwindcss/src/test-utils/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ export async function compileCss(css: string, candidates: string[] = [], options
return optimizeCss(build(candidates)).trim()
}

export async function run(candidates: string[]) {
export async function run(candidates: string[], { optimize = true } = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of having to add an object with optimize to every call site. How do you feel about this?

I’m wondering if we:

  • Should make this the default (or is the number of run() calls that do need optimize: true even larger than this subset?
  • Should instead add a second runOptimized export instead of adding a boolean variable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not a fan but not enough to really care. I think unoptimized is not the default. Pretty sure more tests require an optimized CSS result than not but I don't have a good idea of what the function should be called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny thing is, I did use a new method initially (14817cb) but run vs runOptimized or vs build all felt wrong, so did a fallback here because typically you run it without.

You could argue that we just don't run the tests through Lightning CSS (which will make the tests bigger but faster).

let { build } = await compile('@tailwind utilities;')
return optimizeCss(build(candidates)).trim()
let css = build(candidates)
return optimize ? optimizeCss(css).trim() : css.trim()
}

export function optimizeCss(
Expand Down
Loading