Skip to content

Commit 1648acc

Browse files
committedMay 2, 2020
Writing gulp process
1 parent 7095dc1 commit 1648acc

File tree

5 files changed

+4110
-459
lines changed

5 files changed

+4110
-459
lines changed
 

‎.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
website.publishproj
2-
*.pubxml
3-
bower_components
41
.vscode/launch.json
52
.vscode/settings.json
6-
node_modules
3+
node_modules
4+
tmp
5+
dist

‎gulpfile.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
var gulp = require('gulp');
2+
var inject = require('gulp-inject');
3+
4+
var paths = {
5+
src: '**/*',
6+
srcHTML: '*.htm',
7+
srcCSS: 'css/*.css',
8+
srcNodeCSS: [
9+
'node_modules/bootswatch/dist/sandstone/bootstrap.min.css',
10+
'node_modules/font-awesome/css/font-awesome.min.css',
11+
'node_modules/dc/dc.min.css'
12+
],
13+
srcJS: 'js/*.js',
14+
srcNodeJS: [
15+
'node_modules/jquery/dist/jquery.min.js',
16+
'node_modules/popper.js/dist/umd/popper.min.js',
17+
'node_modules/bootstrap/dist/js/bootstrap.min.js',
18+
'node_modules/jquery-csv/src/jquery.csv.min.js',
19+
'node_modules/crossfilter2/crossfilter.min.js',
20+
'node_modules/d3/dist/d3.min.js',
21+
'node_modules/dc/dc.min.js'
22+
],
23+
tmp: 'tmp',
24+
tmpIndex: 'tmp/index.htm',
25+
tmpCSS: 'tmp/css/',
26+
tmpJS: 'tmp/js',
27+
dist: 'dist',
28+
distIndex: 'dist/index.htm',
29+
distCSS: 'dist/css/*.css',
30+
distJS: 'dist/js/*.js'
31+
};
32+
33+
gulp.task('html', function () {
34+
return gulp.src(paths.srcHTML).pipe(gulp.dest(paths.tmp));
35+
});
36+
37+
gulp.task('cssnode', function () {
38+
return gulp.src(paths.srcNodeCSS).pipe(gulp.dest(paths.tmpCSS));
39+
});
40+
41+
gulp.task('css', function () {
42+
return gulp.src(paths.srcCSS).pipe(gulp.dest(paths.tmpCSS));
43+
});
44+
45+
gulp.task('jsnode', function () {
46+
return gulp.src(paths.srcNodeJS).pipe(gulp.dest(paths.tmpJS));
47+
});
48+
49+
gulp.task('js', function () {
50+
return gulp.src(paths.srcJS).pipe(gulp.dest(paths.tmpJS));
51+
});
52+
53+
gulp.task('copy', gulp.series('html', 'cssnode', 'css', 'jsnode', 'js'));
54+
55+
gulp.task('injectjs', function () {
56+
var target = gulp.src('tmp/*.htm');
57+
var sources = gulp.src('tmp/js/*.js', { read: false, relative: true });
58+
return target.pipe(inject(sources)).pipe(gulp.dest('./tmp'));
59+
});
60+
61+
gulp.task('injectcss', function () {
62+
var target = gulp.src('tmp/*.htm');
63+
var sources = gulp.src('tmp/js/*.css', { read: false, relative: true });
64+
return target.pipe(inject(sources)).pipe(gulp.dest('./tmp'));
65+
});
66+
67+
gulp.task('tmp', gulp.series('copy', 'injectjs', 'injectcss'));

‎index.htm

+15-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html lang="en">
33

44
<head>
5+
56
<meta charset="utf-8">
67
<meta http-equiv="X-UA-Compatible" content="IE=edge">
78
<meta name="viewport" content="width=device-width, initial-scale=1">
89
<title>Usage | Toon Libraries</title>
10+
11+
<!-- inject:css -->
12+
<!-- endinject -->
13+
914
<link href="node_modules/bootswatch/dist/sandstone/bootstrap.min.css" rel="stylesheet" />
1015
<link href="node_modules/dc/dc.min.css" rel="stylesheet" />
1116
<link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
12-
<link href="css/custom.css" rel="stylesheet" />
1317
</head>
1418

1519
<body>
@@ -64,10 +68,10 @@
6468
</div>
6569
</div>
6670
</div>
67-
<br/>
6871

6972
<h4>Loans</h4>
70-
<p>Loans are items being borrowed or renewed. You can see differences between the number of items being borrowed over the years, but also the pattern over a year, and between different libraries.</p>
73+
<p>Loans are items being borrowed or renewed. You can see differences between the number of items being borrowed
74+
over the years, but also the pattern over a year, and between different libraries.</p>
7175
<hr />
7276
<div class="row">
7377
<div class="col-md-3 col-sm-12">
@@ -95,10 +99,10 @@ <h4>Loans</h4>
9599
</div>
96100
</div>
97101
</div>
98-
<br /><br />
99102

100103
<h4>Visits</h4>
101-
<p>Visits are people entering a library. This shows a similar pattern of usage to loans, though with less variation between months.</p>
104+
<p>Visits are people entering a library. This shows a similar pattern of usage to loans, though with less
105+
variation between months.</p>
102106
<hr />
103107
<div class="row">
104108
<div class="col-md-3 col-sm-12">
@@ -126,7 +130,6 @@ <h4>Visits</h4>
126130
</div>
127131
</div>
128132
</div>
129-
<br /><br />
130133

131134
<h4>Enquiries</h4>
132135
<p>Enquiries are questions asked by the public.</p>
@@ -159,10 +162,10 @@ <h4>Enquiries</h4>
159162
</div>
160163
</div>
161164
</div>
162-
<br /><br />
163165

164166
<h4>PC utilisation</h4>
165-
<p>PC utilisation is percentage of available time computers were booked. This shows a more uniform pattern of usage between libraries as the measure is relative to how many computer hours are available.</p>
167+
<p>PC utilisation is percentage of available time computers were booked. This shows a more uniform pattern of
168+
usage between libraries as the measure is relative to how many computer hours are available.</p>
166169
<hr />
167170
<div class="row">
168171
<div class="col-md-3 col-sm-12">
@@ -193,7 +196,6 @@ <h4>PC utilisation</h4>
193196
</div>
194197
</div>
195198
</div>
196-
<br /><br />
197199

198200
<h4>Usage by type over time</h4>
199201
<hr />
@@ -207,8 +209,6 @@ <h4>Usage by type over time</h4>
207209
</div>
208210
</div>
209211
</div>
210-
<br />
211-
<br />
212212
<hr />
213213
<p>An open source project available on <a href="https://github.com/LibrariesHacked/wuthering-hacks"
214214
target="_blank">GitHub</a>. <a href="https://twitter.com/ToonLibraries" target="_blank"
@@ -217,15 +217,9 @@ <h4>Usage by type over time</h4>
217217
title="Creative Commons Licence Details">Creative Commons Public Domain licence</a>.</p>
218218
</div>
219219

220-
<script src="node_modules/jquery/dist/jquery.min.js"></script>
221-
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
222-
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
223-
<script src="node_modules/d3/dist/d3.min.js"></script>
224-
<script src="node_modules/crossfilter2/crossfilter.min.js"></script>
225-
<script src="node_modules/dc/dc.min.js"></script>
226-
<script src="node_modules/jquery-csv/src/jquery.csv.min.js"></script>
227-
<script src="js/config.js"></script>
228-
<script src="js/usage.js"></script>
220+
<!-- inject:js -->
221+
<!-- endinject -->
222+
229223
</body>
230224

231225
</html>

‎package-lock.json

+3,989-402
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+36-32
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
{
2-
"name": "wuthering-hacks",
3-
"version": "1.0.0",
4-
"description": "Wuthering Hacks",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
9-
"repository": {
10-
"type": "git",
11-
"url": "git+https://github.com/LibrariesHacked/wuthering-hacks.git"
12-
},
13-
"author": "",
14-
"license": "MIT",
15-
"bugs": {
16-
"url": "https://github.com/LibrariesHacked/wuthering-hacks/issues"
17-
},
18-
"homepage": "https://github.com/LibrariesHacked/wuthering-hacks#readme",
19-
"dependencies": {
20-
"bootstrap": "^4.3.1",
21-
"bootswatch": "^4.3.1",
22-
"colorbrewer": "^1.3.0",
23-
"crossfilter2": "^1.4.7",
24-
"d3": "^5.12.0",
25-
"dc": "^3.1.3",
26-
"dc.leaflet": "^0.4.0",
27-
"font-awesome": "^4.7.0",
28-
"jquery": "^3.4.1",
29-
"jquery-csv": "^1.0.5",
30-
"leaflet": "^1.5.1",
31-
"mapbox-gl-leaflet": "0.0.11",
32-
"popper.js": "^1.15.0"
33-
}
2+
"name": "wuthering-hacks",
3+
"version": "1.0.0",
4+
"description": "Wuthering Hacks",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/LibrariesHacked/wuthering-hacks.git"
12+
},
13+
"author": "Libraries Hacked",
14+
"license": "MIT",
15+
"bugs": {
16+
"url": "https://github.com/LibrariesHacked/wuthering-hacks/issues"
17+
},
18+
"homepage": "https://github.com/LibrariesHacked/wuthering-hacks#readme",
19+
"dependencies": {
20+
"bootstrap": "^4.4.1",
21+
"bootswatch": "^4.4.1",
22+
"colorbrewer": "^1.3.0",
23+
"crossfilter2": "^1.5.2",
24+
"d3": "^5.16.0",
25+
"dc": "^3.2.1",
26+
"dc.leaflet": "^0.4.0",
27+
"font-awesome": "^4.7.0",
28+
"jquery": "^3.5.0",
29+
"jquery-csv": "^1.0.11",
30+
"leaflet": "^1.6.0",
31+
"mapbox-gl-leaflet": "0.0.11",
32+
"popper.js": "^1.16.1"
33+
},
34+
"devDependencies": {
35+
"gulp": "^4.0.2",
36+
"gulp-inject": "^5.0.5"
37+
}
3438
}

0 commit comments

Comments
 (0)
Please sign in to comment.