Skip to content

Commit e6b155c

Browse files
authored
Merge pull request #7257 from plotly/only-keep-js-in-dist
Do not keep empty CSS files generated by `esbuild` on the repository
2 parents 7642e51 + e7f5748 commit e6b155c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build/*
55
!build/README.md
66

77
dist/*.LICENSE.txt
8+
dist/*.css
89

910
npm-debug.log*
1011
*.sublime*

tasks/util/bundle_wrapper.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fs from 'fs';
12
import fsExtra from 'fs-extra';
23
import prependFile from 'prepend-file';
34

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

4445
await build(config);
4546

46-
addWrapper(pathToBundle)
47+
addWrapper(pathToBundle);
48+
49+
if(pathToBundle.endsWith('.js')) {
50+
var len = pathToBundle.length;
51+
var cssOutput = pathToBundle.slice(0, len - 3) + '.css';
52+
53+
// remove unwanted css file
54+
if (fs.existsSync(cssOutput)) {
55+
fs.unlinkSync(cssOutput);
56+
}
57+
}
4758

4859
if(cb) cb();
4960
}

0 commit comments

Comments
 (0)