Skip to content

Commit

Permalink
Fix static glob to not clobber other transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Dec 16, 2021
1 parent af2dbae commit 420b511
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions examples/basic/src/global.client.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { toggleTheme } from 'mine.css'

window.toggleTheme = toggleTheme

console.log('The global client is loaded on every page.')

// Try to keep this file as small as possible.
Expand Down
9 changes: 4 additions & 5 deletions lib/build-static/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { promisify } from 'node:util'
import cpx from 'cpx2'
const copy = promisify(cpx.copy)
const copy = cpx.copy

export function getCopyGlob (src) {
return `${src}/**/*.!(js|css|html|md)`
return `${src}/**/!(*.js|*.css|*.html|*.md)`
}

/**
* run CPX2 on src folder
*/
export function buildStatic (src, dest, opts = {}) {
return copy(getCopyGlob(src), dest, { ignore: opts.ignore })
export async function buildStatic (src, dest, opts = {}) {
return await copy(getCopyGlob(src), dest, { ignore: opts.ignore })
}

0 comments on commit 420b511

Please sign in to comment.