Skip to content

Commit dcae1cb

Browse files
committed
Adds LESS loader egs + updates package & readme.md
1 parent 85ca405 commit dcae1cb

File tree

6 files changed

+46
-1
lines changed

6 files changed

+46
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Learning WEBPACK - MODULE BUNDLER
22

3+
## Table of Content
34
|Eg.No.|Execution Command|Comments|
45
|------|-----------------|--------|
56
|1|```webpack entry.js bundle.js```|Webpack will read entry.js file to build bundle.js|
@@ -19,3 +20,4 @@
1920
|12|```webpack```|Shows how to load raw file|
2021
|13|```webpack```|Shows how to configure jshint & JSCS loaders for JavaScript linting|
2122
|14|```webpack```|Shows how to load Handlebars templates file|
23+
|15|```webpack```|Shows how to load LESS loader|

codes/example-15/entry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./styles.less');

codes/example-15/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Eg15: LESS loader</title>
6+
</head>
7+
<body>
8+
<div id="container">
9+
<h1>Hello World</h1>
10+
<h2>Experiment with Webpack</h2>
11+
</div>
12+
13+
<script type="text/javascript" src="bundle.js"></script>
14+
</body>
15+
</html>

codes/example-15/styles.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@h1-color: blue;
2+
@h2-color: green;
3+
4+
#container {
5+
h1 {
6+
color: @h1-color;
7+
}
8+
9+
h2 {
10+
color: @h2-color;
11+
}
12+
}

codes/example-15/webpack.config.js

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
},
2323
"homepage": "https://github.com/hegdeashwin/learning-webpack#readme",
2424
"devDependencies": {
25-
"css-loader": "^0.23.0",
25+
"autoprefixer-loader": "^3.1.0",
26+
"css-loader": "^0.23.1",
2627
"csslint": "^0.10.0",
2728
"csslint-loader": "^0.2.1",
2829
"eslint": "^1.10.3",
2930
"eslint-loader": "^1.1.1",
3031
"handlebars": "^4.0.5",
3132
"handlebars-loader": "^1.1.4",
33+
"html-loader": "^0.4.0",
34+
"image-webpack-loader": "^1.6.2",
3235
"jscs": "^2.7.0",
3336
"jscs-loader": "^0.2.0",
3437
"jshint": "^2.8.0",

0 commit comments

Comments
 (0)