Skip to content

Commit

Permalink
🐛 fix some more typos
Browse files Browse the repository at this point in the history
  • Loading branch information
AriaFallah committed Feb 5, 2016
1 parent 256b2ed commit def9f3f
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 55 deletions.
22 changes: 11 additions & 11 deletions part1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ For example in the diagram above I had
require('./styles.css')
```

If I include [the css-loader](https://github.com/webpack/css-loader) in my webpack config, this is not only perfectly valid, but also will actually apply the CSS to my page.
If I include [the style-loader](https://github.com/webpack/style-loader) and the [the css-loader](https://github.com/webpack/css-loader) in my webpack config, this is not only perfectly
valid, but also will actually apply the CSS to my page.

This is just a single example of the many loaders you can use with webpack.

Expand Down Expand Up @@ -352,9 +353,9 @@ MyDirectory
[Example 4](https://github.com/AriaFallah/WebpackTutorial/tree/master/part1/example4)

Earlier in the tutorial I mentioned [loaders](#loaders). These will help us require non-js files in
our code. In this case, the only loader we will need is the css loader. First we need to install the loader:
our code. In this case, we will need the style loader and the css loader. First we need to install the loaders:

npm install --save-dev css-loader
npm install --save-dev style-loader css-loader

Now that it's installed we can tweak our config to include the css loader:

Expand All @@ -377,7 +378,7 @@ module.exports = {
}),
new webpack.optimize.OccurenceOrderPlugin()
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand All @@ -388,7 +389,7 @@ module.exports = {

Going over the new properties one by one:

* [modules](http://webpack.github.io/docs/configuration.html#module) - Options affecting your files
* [module](http://webpack.github.io/docs/configuration.html#module) - Options affecting your files
* [loaders](http://webpack.github.io/docs/configuration.html#module-loaders) - An array of loaders that we specify for our application
* test - A regular expression to match the loader with a file
* loaders - Which loaders to use for files that match the test
Expand Down Expand Up @@ -461,7 +462,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand All @@ -486,7 +487,7 @@ actually populate it.
<h1>Very Website</h1>
<section id="color"></section>
<button id="button">Such Button</button>
<script src="bundle.js"></script>

</body>
</html>
```
Expand Down Expand Up @@ -541,7 +542,7 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
Expand All @@ -557,7 +558,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down Expand Up @@ -585,7 +586,6 @@ Summarized:
* devServer
* contentBase: Where to serve files from
* hot: enable HMR
---

The prod config doesn't change much

Expand Down Expand Up @@ -613,7 +613,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
output: {
filename: 'bundle.js',
},
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
}),
new webpack.optimize.OccurenceOrderPlugin()
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example4/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
}),
new webpack.optimize.OccurenceOrderPlugin()
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
4 changes: 2 additions & 2 deletions part1/example5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand All @@ -59,7 +59,7 @@ actually populate it.
<h1>Very Website</h1>
<section id="color"></section>
<button id="button">Such Button</button>
<script src="bundle.js"></script>

</body>
</html>
```
Expand Down
2 changes: 1 addition & 1 deletion part1/example5/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<h1>Very Website</h1>
<section id="color"></section>
<button id="button">Such Button</button>
<script src="bundle.js"></script>

</body>
</html>
2 changes: 1 addition & 1 deletion part1/example5/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
6 changes: 3 additions & 3 deletions part1/example6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
Expand All @@ -37,7 +37,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example6/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<h1>Very Website</h1>
<section id="color"></section>
<button id="button">Such Button</button>
<script src="bundle.js"></script>

</body>
</html>
4 changes: 2 additions & 2 deletions part1/example6/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
Expand All @@ -19,7 +19,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example6/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
5 changes: 5 additions & 0 deletions part1/example7/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
"author": "",
"license": "MIT",
"devDependencies": {
"css-loader": "^0.23.1",
"html-webpack-plugin": "^2.8.1",
"style-loader": "^0.13.0",
"webpack": "^1.12.13",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"pleasejs": "^0.4.2"
}
}
10 changes: 10 additions & 0 deletions part1/example7/src/changeColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var Please = require('pleasejs')
var div = document.getElementById('color')
var button = document.getElementById('button')

function changeColor() {
div.style.backgroundColor = Please.make_color()
console.log('pls do work')
}

button.addEventListener('click', changeColor)
3 changes: 1 addition & 2 deletions part1/example7/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<body>
<h1>Very Website</h1>
<section id="color"></section>
<button id="button">Such Button</button>
<script src="bundle.js"></script>
<button id="button">Such Button</button>
</body>
</html>
12 changes: 2 additions & 10 deletions part1/example7/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
require('./styles.css') // The page is now styled
var Please = require('pleasejs')
var div = document.getElementById('color')
var button = document.getElementById('button')

function changeColor() {
div.style.color = Please.make_color()
}

button.addEventListener('click', changeColor)
require('./styles.css')
require('./changeColor.js')
13 changes: 6 additions & 7 deletions part1/example7/src/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
h1 {
color: rgb(114, 191, 190);
text-align: center;
}

#color {
Expand All @@ -10,11 +11,9 @@ h1 {

button {
cursor: pointer;
display: inline-block;
height: 20px;
background-color: rgb(123, 109, 198);
color: rgb(255, 255, 255);
padding: 10px 5px;
border-radius: 4px;
border-bottom: 2px solid rgb(143, 132, 200);
display: block;
width: 100px;
outline: 0;
border: 0;
margin: 20px auto;
}
6 changes: 3 additions & 3 deletions part1/example7/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
Expand All @@ -19,7 +19,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/example7/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
6 changes: 3 additions & 3 deletions part1/extra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
Expand All @@ -44,7 +44,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down Expand Up @@ -111,7 +111,7 @@ module.exports = {
process.env.NODE_ENV: JSON.stringify('production')
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
1 change: 1 addition & 0 deletions part1/extra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"license": "MIT",
"devDependencies": {
"html-webpack-plugin": "^2.8.1",
"raw-loader": "^0.5.1",
"webpack": "^1.12.13",
"webpack-dev-server": "^1.14.1"
}
Expand Down
2 changes: 1 addition & 1 deletion part1/extra/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<h1>Very Website</h1>
<section id="color"></section>
<button>Such Button</button>
<script src="bundle.js"></script>

</body>
</html>
4 changes: 2 additions & 2 deletions part1/extra/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-eval-source-mao',
devtool: 'cheap-eval-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server',
Expand All @@ -19,7 +19,7 @@ module.exports = {
template: './src/index.html'
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down
2 changes: 1 addition & 1 deletion part1/extra/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
process.env.NODE_ENV: JSON.stringify('production')
})
],
modules: {
module: {
loaders: [{
test: /\.css$/,
loaders: ["style", "css"]
Expand Down

0 comments on commit def9f3f

Please sign in to comment.