Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not keep empty CSS files generated by esbuild on the repository #7257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build/*
!build/README.md

dist/*.LICENSE.txt
dist/*.css

npm-debug.log*
*.sublime*
Expand Down
13 changes: 12 additions & 1 deletion tasks/util/bundle_wrapper.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'fs';
import fsExtra from 'fs-extra';
import prependFile from 'prepend-file';

Expand Down Expand Up @@ -43,7 +44,17 @@ export default async function _bundle(pathToIndex, pathToBundle, opts, cb) {

await build(config);

addWrapper(pathToBundle)
addWrapper(pathToBundle);

if(pathToBundle.endsWith('.js')) {
var len = pathToBundle.length;
var cssOutput = pathToBundle.slice(0, len - 3) + '.css';

// remove unwanted css file
if (fs.existsSync(cssOutput)) {
fs.unlinkSync(cssOutput);
}
}

if(cb) cb();
}
Expand Down