Skip to content

Commit d7760d6

Browse files
committed
gulp-example initial commit
1 parent dcd6be3 commit d7760d6

6 files changed

Lines changed: 123 additions & 0 deletions

File tree

gulp-example/gulpfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import gulp from 'gulp';
2+

gulp-example/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "gulp-example",
3+
"version": "1.0.0",
4+
"description": "Gulp example",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [
10+
"gulp",
11+
"javascript"
12+
],
13+
"author": "Nikos Konstantakis",
14+
"license": "ISC",
15+
"devDependencies": {
16+
"gulp": "^4.0.2"
17+
}
18+
}

gulp-example/src/css/main.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
body {
2+
padding-left: 10%;
3+
padding-right: 10%;
4+
font-family: 'Open Sans', sans-serif;
5+
}
6+
7+
img {
8+
max-width: 30%;
9+
height: auto;
10+
}

gulp-example/src/data/data.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"id": "16980613 6066",
4+
"name": "Erich",
5+
"sirname": "Good",
6+
"email": "[email protected]"
7+
},
8+
{
9+
"id": "16230507 1231",
10+
"name": "Kylynn",
11+
"sirname": "Petty",
12+
"email": "[email protected]"
13+
},
14+
{
15+
"id": "16710620 4006",
16+
"name": "Veronica",
17+
"sirname": "Ramsey",
18+
"email": "[email protected]"
19+
},
20+
{
21+
"id": "16330930 1566",
22+
"name": "Tasha",
23+
"sirname": "Cervantes",
24+
"email": "[email protected]"
25+
},
26+
{
27+
"id": "16010307 8473",
28+
"name": "Damian",
29+
"sirname": "Downs",
30+
"email": "[email protected]"
31+
},
32+
{
33+
"id": "16131017 5219",
34+
"name": "Phyllis",
35+
"sirname": "Macias",
36+
"email": "[email protected]"
37+
},
38+
{
39+
"id": "16321122 2496",
40+
"name": "Dahlia",
41+
"sirname": "Barry",
42+
"email": "[email protected]"
43+
},
44+
{
45+
"id": "16501126 1855",
46+
"name": "Talon",
47+
"sirname": "Mcgowan",
48+
"email": "[email protected]"
49+
}
50+
]

gulp-example/src/imgs/gulp.png

37.8 KB
Loading

gulp-example/src/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Culp Example</title>
8+
<link rel="stylesheet" href="css/main.css">
9+
</head>
10+
11+
<body>
12+
<h1>A Gulp Example Page</h1>
13+
<hr>
14+
<p>This is a Gulp test page.</p>
15+
<img src="imgs/gulp.png" />
16+
<h3>Data</h3>
17+
<p id="dataTable"></p>
18+
19+
<script>
20+
function buildHtmlTable(data) {
21+
console.log(data)
22+
let htmlStr = "<table>"
23+
for (let i = 0; i < data.length; i++) {
24+
htmlStr += "<tr><td>" + data[i].id + "</td>" +
25+
"<td>" + data[i].name + "</td>" +
26+
"<td>" + data[i].sirname + "</td>" +
27+
"<td>" + data[i].email + "</td></tr>"
28+
}
29+
htmlStr = htmlStr + "</table>"
30+
return htmlStr
31+
}
32+
33+
let data = ""
34+
fetch('data/data.json')
35+
.then(response => response.json())
36+
.then(jsonData => data = jsonData)
37+
.then(data => document.getElementById("dataTable").innerHTML=buildHtmlTable(data))
38+
.catch(err => console.log(err))
39+
40+
</script>
41+
</body>
42+
43+
</html>

0 commit comments

Comments
 (0)