Replies: 1 comment
-
Got it working with a plugin (on Bun v1.2): Bun.build({
entrypoints: ['mycssfile.css'],
minify: true,
plugins: [{
name: 'mark non-css files as external',
setup(build) {
build.onResolve({ filter: /.*/, namespace: 'file' }, args => {
// Mark non-css files external. Might need some more handling later on?
if (args.kind === 'internal') return { ...args, external: true }
})
},
}],
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, I wanted to use bun for minifying css files. I want css imports to be minified, but ignore e.g.
url("img.png")
altogether. In conclusion: I want to mark everything but css as external.I tried something like glob negation, but it didn't work (though I'm not even sure if this is correct glob syntax).
Bun.build({ entrypoints: [someCssFile], ..., external: ['*.[!css]'] }
Does anyone know of a way to make everything external but a single file type, without manually listing all the file extensions?
Cross post with discord: https://discord.com/channels/876711213126520882/1333325554145034241
Beta Was this translation helpful? Give feedback.
All reactions