Skip to content

Commit 9b2511f

Browse files
committed
Update wording
1 parent da05f62 commit 9b2511f

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[{package.json,README.md}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Webpack Omit JS for CSS Plugin
22

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
44

55
## Rationale
66

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.
88

99
Example as a file
1010
```js
@@ -18,11 +18,8 @@ module.exports = {
1818
'common.styles' : 'styles.js'
1919
}
2020
}
21-
// Webpack Output:
22-
// common.styles.js (Not Needed)
23-
// common.styles.css
2421
```
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.
2623
2724
Example as an array
2825
```js
@@ -34,11 +31,10 @@ module.exports = {
3431
]
3532
}
3633
}
37-
// Webpack Output:
38-
// common.styles.js (Not Needed)
39-
// common.styles.css
4034
```
41-
35+
In both examples Webpack would output:
36+
common.styles.js (Not Needed)
37+
common.styles.css
4238

4339
## Installation
4440
```bash
@@ -50,12 +46,12 @@ npm install --save-dev webpack-omit-js-for-css-plugin
5046
const OmitJSforCSSPlugin = require("webpack-omit-js-for-css-plugin");
5147

5248
module.exports = {
53-
plugins: [
54-
new OmitJSforCSSPlugin()
55-
]
49+
plugins: [
50+
new OmitJSforCSSPlugin()
51+
]
5652
}
5753
```
58-
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
5955
6056
## Options
6157
```js
@@ -68,4 +64,4 @@ new OmitJSforCSSPlugin(options: object)
6864
|**`verbose`**|`{Boolean}`|false|Whether it should display which files will be omitted to the console|
6965

7066
## 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:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webpack-omit-js-for-css-plugin",
33
"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",
55
"main": "src/index.js",
66
"directories": {
77
"test": "test"

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* 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
44
*/
55

66
const chalk = require('chalk');

0 commit comments

Comments
 (0)