Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 22d483e

Browse files
Merge pull request #50 from PracticeJavaScript/updating
Updating
2 parents a050b9d + dff56a3 commit 22d483e

File tree

10 files changed

+115
-50
lines changed

10 files changed

+115
-50
lines changed

‎README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@
1818

1919
## How To Install Locally
2020
```bash
21-
npm i -g pnpm # if you don't have pnpm yet
22-
pnpm i -g firebase-tools # if you don't have firebase-tools yet
23-
pnpm i -g gulp gulp-cli # if you don't have gulp yet
2421
git clone https://github.com/PracticeJavaScript/practicejavascript.com.git
2522
cd practicejavascript.com
26-
pnpm i
27-
gulp # watch is default gulp task
23+
npm i
24+
npm start # start gulp watch
2825
# Another tab
29-
firebase serve
26+
npm run serve# serves content out of /public dir
3027
```
3128

3229
- That will build it all and watch the css, img, and js assets.
33-
- Then you can load up `http://localhost:5000` or `public/index.html` in a browser. narf!
30+
- Then you can load up `http://localhost:8080` in a browser. narf!
3431
`/src/index.js`, `/src/css/style.scss`, and `/src/html/index.html` are the main files you'll want to edit for functionality.
3532
- If you have the [LiveReload Chrome extension](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei) installed, it should do live css updates in your browser while gulp watch is running
3633
- CSS is auto-prefixed for the supported browserslist, so don't manually add any browser prefixes to CSS src.

‎gulpfile.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const livereload = require('gulp-livereload');
2020
const htmlmin = require('gulp-htmlmin');
2121
const swPrecache = require('sw-precache');
2222
const image = require('gulp-image');
23-
const pump = require('pump');
2423

2524
// CONFIG
2625
// ============================================================
@@ -35,7 +34,8 @@ const opts = {
3534
}
3635
};
3736

38-
const uglifyConf = {};
37+
const prepackConfig = {};
38+
const uglifyConfig = {};
3939

4040
const htmlminConfig = {
4141
collapseWhitespace: true,
@@ -50,6 +50,7 @@ const imageConfig = {
5050
jpegoptim: true
5151
};
5252

53+
5354
// TASKS
5455
// ============================================================
5556

@@ -74,14 +75,15 @@ function compile(watch) {
7475
.pipe(sourcemaps.init({
7576
loadMaps: true
7677
}))
77-
.pipe(uglify())
78+
.pipe(uglify(uglifyConfig))
7879
.pipe(sourcemaps.write('./'))
7980
.pipe(gulp.dest('./public/dist/js'));
8081
}
8182
if (watch) {
8283
bundler.on('update', () => {
8384
console.log('-> bundling...');
8485
rebundle();
86+
livereload();
8587
console.log('done bundling.');
8688
});
8789
}
@@ -92,6 +94,7 @@ function watch() {
9294
return compile(true);
9395
}
9496

97+
9598
// CSS
9699
// ============================================================
97100

@@ -113,6 +116,7 @@ cssWatcher.on('change', event => {
113116
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
114117
});
115118

119+
116120
// OTHER JS
117121
// ============================================================
118122

@@ -121,7 +125,7 @@ gulp.task('js', () => {
121125
.pipe(sourcemaps.init({
122126
loadMaps: true
123127
}))
124-
.pipe(uglify(uglifyConf))
128+
.pipe(uglify(uglifyConfig))
125129
.pipe(sourcemaps.write('./'))
126130
.pipe(gulp.dest('./public/dist/js'));
127131
});
@@ -132,6 +136,7 @@ jsWatcher.on('change', event => {
132136
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
133137
});
134138

139+
135140
// IMG
136141
// ============================================================
137142

@@ -156,6 +161,7 @@ imgWatcher.on('change', event => {
156161
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
157162
});
158163

164+
159165
// HTML
160166
// ============================================================
161167

@@ -171,6 +177,7 @@ htmlWatcher.on('change', event => {
171177
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
172178
});
173179

180+
174181
// SERVICE WORKER
175182
// ============================================================
176183

@@ -191,7 +198,7 @@ gulp.task('optimize-service-worker', ['generate-service-worker'], () => {
191198
.pipe(sourcemaps.init({
192199
loadMaps: true
193200
}))
194-
.pipe(uglify(uglifyConf))
201+
.pipe(uglify(uglifyConfig))
195202
.pipe(sourcemaps.write('./'))
196203
.pipe(gulp.dest('./public'));
197204
});
@@ -205,6 +212,7 @@ swWatcher.on('change', event => {
205212
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
206213
});
207214

215+
208216
// MANIFEST
209217
// ============================================================
210218

@@ -219,6 +227,7 @@ manifestWatcher.on('change', event => {
219227
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
220228
});
221229

230+
222231
// BUILD
223232
// ============================================================
224233

@@ -234,4 +243,6 @@ function glob() {
234243
return 'typeof self !== "undefined" ? self : ' + 'typeof window !== "undefined" ? window : {}'; // eslint-disable-line no-useless-concat
235244
}
236245

246+
247+
// gulp.task('default', ['build', 'manifest', 'service-worker', 'watch']);
237248
gulp.task('default', ['build', 'manifest', 'service-worker', 'watch']);

‎package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
},
99
"scripts": {
1010
"test": "",
11+
"start": "./node_modules/.bin/gulp watch",
12+
"serve": "./node_modules/.bin/http-server",
1113
"build": "./node_modules/.bin/gulp build",
12-
"watch": "./node_modules/.bin/gulp watch",
1314
"precommit": "npm test",
1415
"prepush": "npm test"
1516
},
@@ -68,10 +69,10 @@
6869
"gulp-svgo": "^1.0.3",
6970
"gulp-uglify": "^3.0.0",
7071
"gulp-util": "^3.0.8",
72+
"http-server": "^0.10.0",
7173
"husky": "^0.13.3",
7274
"lint-staged": "^3.4.0",
7375
"localforage": "^1.5.0",
74-
"pump": "^1.0.2",
7576
"rollup-stream": "^1.19.0",
7677
"sw-precache": "^5.1.1",
7778
"uglify-es": "^3.0.15",

‎public/dist/js/bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/dist/js/bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/service-worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /