@@ -6,8 +6,20 @@ import { fileURLToPath } from 'node:url';
66import { compileAsync } from 'sass' ;
77
88const SRC_DIR = path . resolve ( 'src' ) ;
9- const ENTRY_FILE = path . join ( SRC_DIR , 'styling/index.scss' ) ;
10- const OUTPUT_FILE = path . resolve ( 'dist/css/index.css' ) ;
9+ const STYLE_ENTRYPOINTS = [
10+ {
11+ entryFile : path . join ( SRC_DIR , 'styling/index.scss' ) ,
12+ outputFile : path . resolve ( 'dist/css/index.css' ) ,
13+ } ,
14+ {
15+ entryFile : path . join ( SRC_DIR , 'styling/_emoji-replacement.scss' ) ,
16+ outputFile : path . resolve ( 'dist/css/emoji-replacement.css' ) ,
17+ } ,
18+ {
19+ entryFile : path . join ( SRC_DIR , 'plugins/Emojis/styling/index.scss' ) ,
20+ outputFile : path . resolve ( 'dist/css/emoji-picker.css' ) ,
21+ } ,
22+ ] ;
1123const SCSS_EXTENSION = '.scss' ;
1224const BUILD_DELAY_MS = 150 ;
1325const SCAN_INTERVAL_MS = 500 ;
@@ -29,9 +41,9 @@ const log = (message) => {
2941
3042const isScssFile = ( filename ) => filename . endsWith ( SCSS_EXTENSION ) ;
3143
32- const toOutputRelativePath = ( source ) =>
44+ const toOutputRelativePath = ( source , outputFile ) =>
3345 path
34- . relative ( path . dirname ( OUTPUT_FILE ) , fileURLToPath ( source ) )
46+ . relative ( path . dirname ( outputFile ) , fileURLToPath ( source ) )
3547 . split ( path . sep )
3648 . join ( '/' ) ;
3749
@@ -86,23 +98,29 @@ const flushQueuedBuild = () => {
8698 void runBuild ( trigger ) ;
8799} ;
88100
89- const buildStyling = async ( ) => {
90- const { css, sourceMap } = await compileAsync ( ENTRY_FILE , {
101+ const buildStyleEntry = async ( { entryFile , outputFile } ) => {
102+ const { css, sourceMap } = await compileAsync ( entryFile , {
91103 sourceMap : true ,
92104 style : 'expanded' ,
93105 } ) ;
94- const sourceMapFile = `${ path . basename ( OUTPUT_FILE ) } .map` ;
106+ const sourceMapFile = `${ path . basename ( outputFile ) } .map` ;
95107 const normalizedSourceMap = {
96108 ...sourceMap ,
97- file : path . basename ( OUTPUT_FILE ) ,
109+ file : path . basename ( outputFile ) ,
98110 sources : sourceMap . sources . map ( ( source ) =>
99- source . startsWith ( 'file://' ) ? toOutputRelativePath ( source ) : source ,
111+ source . startsWith ( 'file://' ) ? toOutputRelativePath ( source , outputFile ) : source ,
100112 ) ,
101113 } ;
102114
103- await mkdir ( path . dirname ( OUTPUT_FILE ) , { recursive : true } ) ;
104- await writeFile ( OUTPUT_FILE , `${ css } \n\n/*# sourceMappingURL=${ sourceMapFile } */\n` ) ;
105- await writeFile ( `${ OUTPUT_FILE } .map` , JSON . stringify ( normalizedSourceMap ) ) ;
115+ await mkdir ( path . dirname ( outputFile ) , { recursive : true } ) ;
116+ await writeFile ( outputFile , `${ css } \n\n/*# sourceMappingURL=${ sourceMapFile } */\n` ) ;
117+ await writeFile ( `${ outputFile } .map` , JSON . stringify ( normalizedSourceMap ) ) ;
118+ } ;
119+
120+ const buildStyling = async ( ) => {
121+ for ( const entry of STYLE_ENTRYPOINTS ) {
122+ await buildStyleEntry ( entry ) ;
123+ }
106124} ;
107125
108126const runBuild = async ( trigger ) => {
0 commit comments