mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-25 16:44:12 +00:00
Allow whitespace around @source inline() arg (#19461)
## Summary Inspired by #19460, relaxes whitespace syntax around `@source inline(…):` ### Before ```css /* ❌ Error: `@source` paths must be quoted. */ @source inline( "underline" ); @source inline( "underline" ); ``` ### After ```css /* ✅ Generates the class names as normal. */ @source inline( "underline" ); @source inline( "underline" ); ``` ## Test plan Added tests to `packages/tailwindcss/src/index.test.ts`.
This commit is contained in:
parent
1fbdd51a8d
commit
7fcdd84e56
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Do not wrap `color-mix` in a `@supports` rule if one already exists ([#19450](https://github.com/tailwindlabs/tailwindcss/pull/19450))
|
||||
- Allow whitespace around `@source inline()` argument ([#19461](https://github.com/tailwindlabs/tailwindcss/pull/19461))
|
||||
|
||||
### Added
|
||||
|
||||
|
||||
@ -3802,6 +3802,44 @@ describe('@source', () => {
|
||||
|
||||
expect(build(['bg-red-500', 'bg-red-700'])).toMatchInlineSnapshot(`""`)
|
||||
})
|
||||
|
||||
test('works with whitespace around the argument', async () => {
|
||||
let { build } = await compile(
|
||||
css`
|
||||
/* prettier-ignore */
|
||||
@source inline( "underline" );
|
||||
@tailwind utilities;
|
||||
`,
|
||||
{ base: '/root' },
|
||||
)
|
||||
|
||||
expect(build([])).toMatchInlineSnapshot(`
|
||||
".underline {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
"
|
||||
`)
|
||||
})
|
||||
|
||||
test('works with newlines around the argument', async () => {
|
||||
let { build } = await compile(
|
||||
css`
|
||||
/* prettier-ignore */
|
||||
@source inline(
|
||||
"underline"
|
||||
);
|
||||
@tailwind utilities;
|
||||
`,
|
||||
{ base: '/root' },
|
||||
)
|
||||
|
||||
expect(build([])).toMatchInlineSnapshot(`
|
||||
".underline {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
"
|
||||
`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ async function parseCss(
|
||||
|
||||
if (path[0] === 'i' && path.startsWith('inline(')) {
|
||||
inline = true
|
||||
path = path.slice(7, -1)
|
||||
path = path.slice(7, -1).trim()
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user