File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -12,12 +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 => layer . config . srcDir || layer . cwd )
15+ const sources = nuxt . options . _layers . map ( layer => JSON . stringify ( layer . config . srcDir || layer . cwd ) )
16+
17+ // Add variables from Nuxt config that need parsing
18+ const sourceConfigs = [
19+ nuxt . options . app ?. head ?. htmlAttrs ?. class ,
20+ nuxt . options . app ?. head ?. bodyAttrs ?. class ,
21+ ]
22+ sourceConfigs . forEach ( ( value ) => {
23+ if ( value ) sources . push ( `inline(${ JSON . stringify ( value ) } )` )
24+ } )
25+
1626 await nuxt . callHook ( 'tailwindcss:sources:extend' , sources )
1727
1828 const sourcesTemplate = addTemplate ( {
1929 filename : 'tailwindcss/sources.css' ,
20- getContents : ( ) => sources . map ( source => `@source ${ JSON . stringify ( source ) } ;` ) . join ( '\n' ) ,
30+ getContents : ( ) => sources . map ( source => `@source ${ source } ;` ) . join ( '\n' ) ,
2131 write : true ,
2232 } )
2333
You can’t perform that action at this time.
0 commit comments