Skip to content

Commit b246c40

Browse files
authored
Merge pull request #1 from react18-tools/remove-modules
Remove modules and peerDependencies
2 parents 9bf2dbf + bc0f03f commit b246c40

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ interface CSSPluginOptions {
7474
skipAutoPrefixer?: boolean;
7575
/** global CSS class prefix. @defaultValue "" */
7676
globalPrefix?: string;
77+
/** If you want to keep .module.css files */
78+
keepModules?: boolean;
7779
}
7880
```
7981

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# esbuild-plugin-react18-css
2+
3+
## 0.0.1
4+
5+
### Patch Changes
6+
7+
- Remove .module.css files by default.
8+
- 381ec90: Remove peerDependencies

lib/esbuild-plugin-react18-css/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "esbuild-plugin-react18-css",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "0.0.0",
5+
"version": "0.0.1",
66
"description": "ESBuild plugin to handle CSS/SCSS modules, autoprefixer, etc.",
77
"main": "dist/index.js",
88
"types": "dist/index.d.ts",
@@ -29,12 +29,6 @@
2929
"postcss-modules": "^6.0.0",
3030
"sass": "^1.72.0"
3131
},
32-
"peerDependencies": {
33-
"autoprefixer": "10",
34-
"postcss": "8",
35-
"postcss-modules": "6",
36-
"sass": "1"
37-
},
3832
"devDependencies": {
3933
"@types/node": "^20.11.28",
4034
"@vitest/coverage-v8": "^1.4.0",

lib/esbuild-plugin-react18-css/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface CSSPluginOptions {
1515
skipAutoPrefixer?: boolean;
1616
/** global CSS class prefix. @defaultValue "" */
1717
globalPrefix?: string;
18+
/** If you want to keep .module.css files */
19+
keepModules?: boolean;
1820
}
1921

2022
function generateCombinedCSS(result: BuildResult) {
@@ -58,6 +60,10 @@ function applyAutoPrefixer(build: PluginBuild, options: CSSPluginOptions, write?
5860

5961
generateCombinedCSS(result);
6062

63+
if (!options.keepModules) {
64+
result.outputFiles = result.outputFiles?.filter(file => !file.path.match(/\.module\.css$/));
65+
}
66+
6167
/** assume true if undefined */
6268
if (write === undefined || write) {
6369
result.outputFiles?.forEach(file => {

0 commit comments

Comments
 (0)