File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 1- import { transform } from './helpers.js'
2-
31export class CSS {
42 private readonly styles = new Map < string , string > ( )
53
6- async add ( code : string , path : string ) : Promise < string > {
7- const style = await transform ( {
8- file : code ,
9- name : path ,
10- loader : 'css'
11- } )
12-
13- this . styles . set ( path , style . replace ( '\n' , '' ) )
4+ add ( path : string , styles : string ) : string {
5+ this . styles . set ( path , styles . replace ( '\n' , '' ) )
146 return ''
157 }
168
Original file line number Diff line number Diff line change @@ -97,7 +97,13 @@ export default function UserscriptPlugin(
9797 let code = src
9898
9999 if ( regexpStyles . test ( path ) ) {
100- code = await css . add ( src , path )
100+ const styles = await transform ( {
101+ minify : ! isBuildWatch ,
102+ file : code ,
103+ name : path ,
104+ loader : 'css'
105+ } )
106+ code = css . add ( path , styles )
101107 }
102108
103109 if ( path . includes ( config . entry ) ) {
You can’t perform that action at this time.
0 commit comments