Skip to content

Commit 5e3929b

Browse files
committed
Merge pull request #20 from hegdeashwin/develop
Develop
2 parents 11220f7 + dcae1cb commit 5e3929b

File tree

21 files changed

+219
-1
lines changed

21 files changed

+219
-1
lines changed

README.md

Lines changed: 6 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|
@@ -15,3 +16,8 @@
1516
|8|```webpack```|Multiple entry files are allowed|
1617
|9|```webpack```|Code splitting and loading files on demand, Open browser and try ```localhost:8080``` see content-1 is loaded but not content-2, Now try execute ```localhost:8080/#load``` see content-1 and content-2 are both loaded|
1718
|10|```webpack```|Shows how to load 3rd-party plugins|
19+
|11|```webpack```|Shows how to load JSON file|
20+
|12|```webpack```|Shows how to load raw file|
21+
|13|```webpack```|Shows how to configure jshint & JSCS loaders for JavaScript linting|
22+
|14|```webpack```|Shows how to load Handlebars templates file|
23+
|15|```webpack```|Shows how to load LESS loader|

codes/example-11/content.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[{
2+
"name": "Ashwin Hegde",
3+
"job": "Software Engineer",
4+
"skills": "JavaScript, Go, Python, PHP, HTML, CSS"
5+
}, {
6+
"name": "Kumar Kundan",
7+
"job": "Manager",
8+
"skills": "SCRUM master"
9+
}, {
10+
"name": "Ajay Sajwan",
11+
"job": "Manager",
12+
"skills": "Kanban master"
13+
}, {
14+
"name": "Saju S",
15+
"job": "Software Analyst",
16+
"skills": "JavaScript, Java, HTML, CSS, ActionScript"
17+
}, {
18+
"name": "Jerin John",
19+
"job": "Software Engineer",
20+
"skills": "JavaScript, Java, HTML, CSS"
21+
}]

codes/example-11/entry.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var json = require('json!./content.json');
2+
3+
console.clear();
4+
console.log("json data: ");
5+
console.log(json);
6+
7+
for(var i=0; i<json.length;i++) {
8+
console.log("Employee Name: " + json[i].name + " - " + json[i].job);
9+
}

codes/example-11/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Eg11: json loader</title>
6+
</head>
7+
<body>
8+
<h1>Hello Webpack</h1>
9+
10+
<script type="text/javascript" src="bundle.js"></script>
11+
</body>
12+
</html>

codes/example-11/webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
entry: './entry.js',
3+
output: {
4+
filename: 'bundle.js'
5+
}
6+
};

codes/example-12/content.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Hello World,
2+
3+
My name is Ashwin Hegde, I love to work with Open Source Technologies like
4+
JavaScript, Go, Python, PHP, Ruby etc.

codes/example-12/entry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var fileContent = require('raw!./content.txt');
2+
3+
console.clear();
4+
console.log("Raw data: ");
5+
console.log(fileContent);

codes/example-12/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Eg12: txt/raw/file loader</title>
6+
</head>
7+
<body>
8+
<h1>Hello Webpack</h1>
9+
10+
<script type="text/javascript" src="bundle.js"></script>
11+
</body>
12+
</html>

codes/example-12/webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
entry: './entry.js',
3+
output: {
4+
filename: 'bundle.js'
5+
}
6+
};

codes/example-13/entry.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function test(a, b) {
2+
var c,d=2;
3+
return a+d;
4+
}
5+
6+
test(1, 2)

0 commit comments

Comments
 (0)