You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-15Lines changed: 11 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Webpack Omit JS for CSS Plugin
2
2
3
-
This plugin will omit the JS files, for CSS only dependencies, that become obsolete once extract-text-plugin extracts all inlined CSS into its own .css file
3
+
This plugin will omit bundled JS files, for dependencies that are exclusively CSS, which become obsolete once extract-text-plugin extracts inlined CSS into its own .css file
4
4
5
5
## Rationale
6
6
7
-
In some cases, you may want to organize some of your CSS dependencies into single files or entry arrays within Webpack. Extract-text-plugin extracts the CSS into its own .css file, but Webpack will still generate a js file that will never be needed. This plugin will omit these types of files before Webpack begins it's emitting step. This plugin is especially useful for Webpack bundles that use a hash in the the filename, as these change on every compilation.
7
+
In certain cases, you may want to organize some of your CSS dependencies into single files or entry arrays within Webpack. Even though Extract-text-plugin extracts CSS into its own .css file, Webpack will still generate a js file that will never be needed. This plugin will omit these types of files before Webpack begins its emitting step, so that you don't have to manually remove them. This plugin is especially useful for Webpack bundles that use a hash in the the filename, as these change on every compilation.
8
8
9
9
Example as a file
10
10
```js
@@ -18,11 +18,8 @@ module.exports = {
18
18
'common.styles':'styles.js'
19
19
}
20
20
}
21
-
// Webpack Output:
22
-
// common.styles.js (Not Needed)
23
-
// common.styles.css
24
21
```
25
-
NOTE: CSS dependencies in a JS file are 1 level deep. It will not recursively check for dependencies that are only CSS when requiring additional JS files.
22
+
> :warning: CSS dependencies in a JS file are 1 level deep. It will not recursively check for dependencies, that are exclusively CSS, when requiring additional JS files.
NOTE: [ExtractTextPlugin](https://github.com/webpack-contrib/extract-text-webpack-plugin"ExtractTextPlugin") is a Peer Dependency. You will need to configure that as you normally would in your webpack.config.js
54
+
> Note: [ExtractTextPlugin](https://github.com/webpack-contrib/extract-text-webpack-plugin"ExtractTextPlugin") is a Peer Dependency. You will need to configure that as you normally would in your webpack.config.js
59
55
60
56
## Options
61
57
```js
@@ -68,4 +64,4 @@ new OmitJSforCSSPlugin(options: object)
68
64
|**`verbose`**|`{Boolean}`|false|Whether it should display which files will be omitted to the console|
69
65
70
66
## Additional Notes
71
-
Although, this plugin supports caching the omissable files on watch, ideally you shouldn't be using this plugin during Development. Rather, it is highly recommended that you only include this plugin when you are building for production.
67
+
:fire::fire: While this plugin supports caching the omissible files on watch, it's not ideal to use this plugin during Development. It's highly recommended you only include this plugin when you're building for production.:fire::fire:
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "webpack-omit-js-for-css-plugin",
3
3
"version": "0.1.0",
4
-
"description": "This Webpack plugin will omit the JS files, for CSS only dependencies, that become obsolete once extract-text-plugin extracts all inlined CSS into its own .css file",
4
+
"description": "This plugin will omit bundled JS files, for dependencies that are exclusively CSS, which become obsolete once extract-text-plugin extracts inlined CSS into its own .css file",
Copy file name to clipboardExpand all lines: src/index.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
/**
2
2
* OmitJSforCSSPlugin
3
-
* @description : This plugin will omit the JS entry files, for CSS only dependencies, that become obsolete once extract-text-plugin extracts all inlined CSS into its own .css file.
3
+
* @description : This plugin will omit bundled JS files, for dependencies that are exclusively CSS, which become obsolete once extract-text-plugin extracts inlined CSS into its own .css file
0 commit comments