Skip to content

Commit 7025489

Browse files
authored
Cleanup CSS and JS files, update dependencies (#217)
My previous [PR](#214), broke the deployment script. Fixing this issue took me down a path, removing a lot of unnecessary dependencies and build steps: - Removed a bunch of unused CSS - Removed Gulp-based asset processing, which is now done by Hugo - Removed unused icons and fonts from being loaded
1 parent b277ca5 commit 7025489

26 files changed

+1353
-3359
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
AWS_ACCESS_KEY_ID: ${{ secrets.NONPCI_AWS_ACCESS_KEY_ID }}
1313
AWS_SECRET_ACCESS_KEY: ${{ secrets.NONPCI_AWS_SECRET_ACCESS_KEY }}
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

1717
- name: build `prod`
1818
run: ./build/build.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ dist/
22
node_modules/
33
website/public/
44
website/static/
5+
.hugo_build.lock
6+
.yarn*

babel.config.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

gulpfile.js

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
const gulp = require('gulp');
2-
const autoprefixer = require('gulp-autoprefixer');
3-
const clean = require('gulp-clean');
42
const exec = require('child_process').exec;
5-
const cleanCSS = require('gulp-clean-css');
6-
const uglify = require('gulp-terser');
7-
const concat = require('gulp-concat');
8-
const imagemin = require('imagemin');
93

104
const argv = require('minimist')(process.argv.slice(2));
115

@@ -30,51 +24,7 @@ const config = {
3024
}
3125
}
3226

33-
function uglifyCSS() {
34-
return gulp.src('src/css/*.css')
35-
.pipe(autoprefixer({
36-
cascade: false
37-
}))
38-
.pipe(cleanCSS({ compatibility: 'ie8' }))
39-
.pipe(gulp.dest('website/static/css'))
40-
};
41-
42-
function prepJS() {
43-
return gulp.src(['src/js/typed.js', 'src/js/main.js'])
44-
.pipe(concat('jsbundle.js'))
45-
.pipe(uglify())
46-
.pipe(gulp.dest('website/static/js'))
47-
};
48-
49-
function prepFonts() {
50-
return gulp.src('src/fonts/*')
51-
.pipe(gulp.dest('website/static/fonts'))
52-
}
53-
54-
function prepBinaries() {
55-
return gulp.src('src/*.pdf', 'src/*.txt')
56-
.pipe(gulp.dest('website/static'))
57-
}
58-
59-
function appBundle() {
60-
return gulp.src('dist/appBundle.js')
61-
.pipe(gulp.dest('website/static/js'))
62-
};
63-
64-
function imageMIN() {
65-
return imagemin(['src/img/**/*'],
66-
{
67-
destination: 'website/static/img',
68-
}
69-
)
70-
}
71-
72-
function hugoClean() {
73-
return gulp.src('website/public', { read: false })
74-
.pipe(clean());
75-
};
76-
77-
function hugoBuild() {
27+
function build() {
7828
const baseUrl = config[argv.env] ? config[argv.env].baseUrl : config['production'].baseUrl;
7929
const command = 'hugo -v -b "' + baseUrl + '" --source=website';
8030

@@ -83,9 +33,6 @@ function hugoBuild() {
8333
});
8434
};
8535

86-
const hugoPrep = gulp.parallel(uglifyCSS, prepJS, prepFonts, prepBinaries, imageMIN);
87-
const build = gulp.series(hugoPrep, hugoBuild);
88-
8936
function publish() {
9037
const options = config[argv.env].aws;
9138
const publisher = awspublish.create(options);
@@ -97,6 +44,5 @@ function publish() {
9744
.pipe(invalidate(options));
9845
};
9946

100-
exports.update = hugoPrep;
10147
exports.build = build;
10248
exports.deploy = gulp.series(build, publish);

package.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
{
22
"name": "gateway_api_docs",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "",
5-
"main": "index.js",
6-
"browsersList": ["last 2 versions"],
5+
"browsersList": [
6+
"last 2 versions"
7+
],
78
"dependencies": {
8-
"@babel/runtime": "^7.4.5",
9-
"auth0-js": "^9.11.0",
10-
"core-js": "3",
119
"gulp": "^4.0.2",
12-
"gulp-autoprefixer": "^7.0.1",
13-
"gulp-clean-css": "^4.0.0",
14-
"gulp-concat": "^2.6.0",
15-
"imagemin":"^7.0.0"
10+
"gulp-awspublish": "^8.0.0"
1611
},
1712
"devDependencies": {
18-
"@babel/plugin-proposal-class-properties": "^7.4.4",
19-
"@babel/plugin-transform-runtime": "^7.4.4",
20-
"@babel/preset-env": "^7.4.5",
21-
"@babel/register": "^7.4.4",
2213
"child_process": "^1.0.2",
2314
"concurrent-transform": "^1.0.0",
24-
"gulp-awspublish": "^4.0.0",
25-
"gulp-clean": "^0.4.0",
2615
"gulp-cloudfront-invalidate": "^0.1.5",
27-
"gulp-terser": "^2.1.0",
2816
"minimist": "^1.2.0"
2917
},
3018
"scripts": {

0 commit comments

Comments
 (0)