File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -12,22 +12,22 @@ const getDefaults = (nuxtConfig: NuxtConfig & { srcDir: string }) => [
1212] . map ( defaultPath => join ( nuxtConfig . srcDir , nuxtConfig . dir ?. assets || 'assets' , defaultPath ) )
1313
1414export default async function importCSS ( nuxt = useNuxt ( ) ) {
15- const sources = nuxt . options . _layers . map ( layer => JSON . stringify ( layer . config . srcDir || layer . cwd ) )
15+ const sources = nuxt . options . _layers . map ( layer => ( { type : 'path' , source : layer . config . srcDir || layer . cwd } ) )
1616
1717 // Add variables from Nuxt config that need parsing
1818 const sourceConfigs = [
1919 nuxt . options . app ?. head ?. htmlAttrs ?. class ,
2020 nuxt . options . app ?. head ?. bodyAttrs ?. class ,
2121 ]
2222 sourceConfigs . forEach ( ( value ) => {
23- if ( value ) sources . push ( `inline( ${ JSON . stringify ( value ) } )` )
23+ if ( value && typeof value === 'string' ) sources . push ( { type : 'inline' , source : value } )
2424 } )
2525
2626 await nuxt . callHook ( 'tailwindcss:sources:extend' , sources )
2727
2828 const sourcesTemplate = addTemplate ( {
2929 filename : 'tailwindcss/sources.css' ,
30- getContents : ( ) => sources . map ( source => `@source ${ source } ;` ) . join ( '\n' ) ,
30+ getContents : ( ) => sources . map ( s => `@source ${ s . type === 'path' ? JSON . stringify ( s . source ) : ` ${ s . type } ( ${ s . source } )` } ;` ) . join ( '\n' ) ,
3131 write : true ,
3232 } )
3333
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export interface ModuleHooks {
3636 /**
3737 * Allows extending sources for Tailwind CSS.
3838 */
39- 'tailwindcss:sources:extend' : ( sources : string [ ] ) => void
39+ 'tailwindcss:sources:extend' : ( sources : Array < { type : string , source : string } > ) => void
4040}
4141
4242declare module '@nuxt/schema' {
You can’t perform that action at this time.
0 commit comments