File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed
packages/vite-plugin-beasties Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 3131 },
3232 "scripts" : {
3333 "build" : " unbuild" ,
34+ "build:stub" : " unbuild --stub" ,
3435 "dev" : " vitest dev" ,
3536 "lint" : " eslint . --fix" ,
3637 "prepare" : " simple-git-hooks" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function beasties(options: ViteBeastiesOptions = {}): Plugin {
2828 configResolved ( resolvedConfig ) {
2929 config = resolvedConfig
3030 beastiesInstance = new Beasties ( {
31+ pruneSource : true ,
3132 ...options . options ,
3233 path : config . build . outDir ,
3334 publicPath : config . base ,
Original file line number Diff line number Diff line change @@ -24,13 +24,7 @@ describe('vite-plugin-beasties', () => {
2424 write : false ,
2525 } ,
2626 plugins : [
27- beasties ( {
28- options : {
29- inlineThreshold : 5000 ,
30- ...options . options ,
31- } ,
32- ...options ,
33- } ) ,
27+ beasties ( options ) ,
3428 ] ,
3529 } ) as RollupOutput
3630
@@ -56,16 +50,16 @@ describe('vite-plugin-beasties', () => {
5650 const hasCssColor = html ?. includes ( 'color: blue' ) || html ?. includes ( 'color:#00f' )
5751 expect ( hasCssColor ) . toBe ( true )
5852
53+ // prunes source
5954 const css = output . find ( file => file . fileName . endsWith ( '.css' ) ) as any
60-
61- expect ( css . source . trim ( ) ) . toMatchInlineSnapshot ( `".test-content{color:#00f;font-weight:700}"` )
55+ expect ( css . source . trim ( ) ) . toMatchInlineSnapshot ( `""` )
6256 } )
6357
64- it ( 'prunes CSS files during the build' , async ( ) => {
65- const { output } = await runViteBuild ( { options : { pruneSource : true } } )
58+ it ( 'allows disabling pruning of source CSS files during the build' , async ( ) => {
59+ const { output } = await runViteBuild ( { options : { pruneSource : false } } )
6660 const css = output . find ( file => file . fileName . endsWith ( '.css' ) ) as any
6761
68- expect ( css . source . trim ( ) ) . toMatchInlineSnapshot ( `""` )
62+ expect ( css . source . trim ( ) ) . toMatchInlineSnapshot ( `".test-content{color:#00f;font-weight:700} "` )
6963 } )
7064
7165 it ( 'respects the filter option' , async ( ) => {
You can’t perform that action at this time.
0 commit comments