Skip to content

Commit ddfa586

Browse files
committed
Output combined stylesheet
1 parent 815798b commit ddfa586

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bin/packages/build.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ async function compileStyles( packageName ) {
892892
const srcDir = path.join( packageDir, 'src' );
893893

894894
// Process .module.css files and generate JS modules
895-
await Promise.all(
895+
const cssResults = await Promise.all(
896896
cssModuleEntries.map( async ( styleEntryPath ) => {
897897
const buildDir = path.join( packageDir, 'build' );
898898
const buildModuleDir = path.join( packageDir, 'build-module' );
@@ -936,9 +936,19 @@ async function compileStyles( packageName ) {
936936
`export default ${ jsExport };\n`
937937
),
938938
] );
939+
940+
// Return the processed CSS for combining
941+
return result.css;
939942
} )
940943
);
941944

945+
// Generate combined stylesheet from all CSS modules
946+
if ( cssResults.length > 0 ) {
947+
const combinedCss = cssResults.join( '\n' );
948+
await mkdir( buildStyleDir, { recursive: true } );
949+
await writeFile( path.join( buildStyleDir, 'style.css' ), combinedCss );
950+
}
951+
942952
// Process SCSS files
943953
await Promise.all(
944954
scssEntries.map( async ( styleEntryPath ) => {

0 commit comments

Comments
 (0)