Skip to content

Commit 6b606bc

Browse files
author
AshwinH
committed
Updates readme.md + addes example-6
1 parent 26b0087 commit 6b606bc

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed

codes/example-6/content.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello webpack");

codes/example-6/entry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
console.log("Hello World");
2+
3+
require("./style.css");
4+
5+
console.log(require("./content.js"));

codes/example-6/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Example 6</title>
6+
</head>
7+
<body>
8+
<h1>Hello World!</h1>
9+
<h2>Welcome to webpack!</h2>
10+
<h3>Learn by practice</h3>
11+
<script type="text/javascript" src="bundle.js"></script>
12+
</body>
13+
</html>

codes/example-6/style.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
body {
2+
background: black;
3+
font-family: arial;
4+
}
5+
6+
h1 {
7+
color: white;
8+
}
9+
10+
h2 {
11+
color: yellow;
12+
}
13+
14+
h3 {
15+
color: pink;
16+
}

codes/example-6/webpack.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
entry: './entry.js',
3+
output: {
4+
path: __dirname,
5+
filename: 'bundle.js'
6+
},
7+
"module": {
8+
loaders: [{
9+
test: /\.css$/,
10+
loader: 'style!css'
11+
}]
12+
}
13+
};

codes/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
|1, 2| webpack entry.js bundle.js| |
44
|3| |we need the ```css-loader``` to process CSS files. We also need the ```style-loader``` to apply the styles in the CSS file. They need to be installed locally, without ```-g```|
55
|4|webpack entry.js bundle.js --module-bind 'css=style!css' | if you are using ```bash``` then use single quotes in Command. Please see https://github.com/webpack/webpack/issues/1453 for more information|
6+
|5|webpack ```OR``` webpack --progress --colors ```OR``` webpack --progress --colors --watch ```OR``` | |
7+
|6|webpack-dev-server --progress --colors --watch|webpack-dev-server is a development server, it binds a small express server on localhost:8080 which serves your static assets as well as the bundle |

0 commit comments

Comments
 (0)