diff --git a/CHANGELOG.md b/CHANGELOG.md index 7829df19c..be8ec9aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/tailwindcss/src/index.test.ts b/packages/tailwindcss/src/index.test.ts index 595950464..2d6ab8daf 100644 --- a/packages/tailwindcss/src/index.test.ts +++ b/packages/tailwindcss/src/index.test.ts @@ -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; + } + " + `) + }) }) }) diff --git a/packages/tailwindcss/src/index.ts b/packages/tailwindcss/src/index.ts index 512c2f831..a511b0838 100644 --- a/packages/tailwindcss/src/index.ts +++ b/packages/tailwindcss/src/index.ts @@ -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 (