Skip to content

Commit 08a74f1

Browse files
committed
Merge pull request #19 from nilshartmann/master
Add description of used npm modules
2 parents 20f564d + 7d42a23 commit 08a74f1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

Diff for: README.md

+61
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,73 @@ $ npm install
1111
$ npm start & open http://localhost:8080
1212
```
1313

14+
## npm modules required for CSS modules
15+
16+
In this project's `package.json` file you find a lot of npm modules for this demo application. Since not all of them are required for the actual CSS modules features,
17+
we've created the following list to describe their purposes.
18+
19+
**Required modules**
20+
21+
The following modules are the only ones really needed to get started with CSS modules:
22+
23+
|Module|Description|
24+
|------|------------|
25+
|[Webpack]|Webpack (obviously...)|
26+
|[webpack-dev-server]|(Optional) Supports hotloading of changed files etc while developing||
27+
|[style-loader] and [css-loader]|`style-loader` and `css-loader` process your CSS files. `css-loader` is the loader that actual makes [CSS modules] work|
28+
29+
To make CSS modules work with Webpack you only have to include the modules mentioned above and add the following loader to your `webpack.config.js` file:
30+
```
31+
. . .
32+
{
33+
test: /\.css$/,
34+
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
35+
}
36+
. . .
37+
```
38+
39+
**Optional modules**
40+
41+
The following modules control the *actual CSS processing*. They are *not* CSS modules specific and can be used with both "regular" CSS and CSS modules:
42+
43+
|Module|Description|
44+
|------|------------|
45+
|[postcss-loader](https://github.com/postcss/postcss-loader)|Allows execution of various CSS post processor in Webpack. Required for `autoprefixer-core` and `postcss-color-rebeccapurple`|
46+
|[autoprefixer-core](https://github.com/ai/autoprefixer-core)|Add vendor-prefixes to your css code (according to the GitHub page it is deprecated and should be replaced by [autoprefixer](https://github.com/postcss/autoprefixer)|
47+
|[postcss-color-rebeccapurple](https://github.com/postcss/postcss-color-rebeccapurple)|Another CSS post processor. Only needed to support `rebeccapurple` color in CSS|
48+
|[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin)|Writes the CSS code processed by Webpack into an own CSS-file and not into the generated bundle JavaScript file.|
49+
50+
**Unrelated modules**
51+
52+
This modules are only needed for the demo application:
53+
54+
|Module|Description |
55+
|------|------------|
56+
|[babel]|ESx-to-ES5 compiler. Mostly needed for React code|
57+
|[ejs]|JavaScript templating language|
58+
|[react-to-html-webpack-plugin]|Webpack plug-in that renders React components|
59+
|[node-libs-browser]|Node libraries for in-browser use|
60+
|[gh-pages]|Publishes file to a `gh-pages` branches for GitHub pages|
61+
|[url-loader]|Webpack file handling, e.g. for images|
62+
|[file-loader]|Webpack file handling, e.g. for images|
63+
|[raw-loader]|It’s used to load raw css files (as utf8) into the demo so it can be rendered into `<code>`|
64+
1465
## License
1566

1667
[MIT]
1768

1869
[CSS Modules]: https://github.com/css-modules/css-modules
1970
[Webpack]: http://webpack.github.io
71+
[webpack-dev-server]: https://webpack.github.io/docs/webpack-dev-server.html
2072
[css-loader]: https://github.com/webpack/css-loader
2173
[module mode]: https://github.com/webpack/css-loader/#css-modules
74+
[style-loader]: https://github.com/webpack/style-loader
75+
[url-loader]: https://github.com/webpack/url-loader
76+
[file-loader]: https://github.com/webpack/file-loader
77+
[raw-loader]: https://github.com/webpack/raw-loader
78+
[babel]: https://babeljs.io
79+
[node-libs-browser]: https://github.com/webpack/node-libs-browser
80+
[gh-pages]: https://github.com/tschaub/gh-pages
81+
[react-to-html-webpack-plugin]: https://github.com/markdalgleish/react-to-html-webpack-plugin
82+
[ejs]: http://www.embeddedjs.com/
2283
[MIT]: http://markdalgleish.mit-license.org

0 commit comments

Comments
 (0)