Minify CSS and JS

parent bc1e79d2
Pipeline #99 passed with stage
in 2 minutes and 7 seconds
...@@ -15,6 +15,7 @@ before_script: ...@@ -15,6 +15,7 @@ before_script:
- ./scripts/ci_fix_baseurl.sh - ./scripts/ci_fix_baseurl.sh
- jekyll build -d public - jekyll build -d public
- ./scripts/purgecss.sh public - ./scripts/purgecss.sh public
- ./scripts/minifycssjs.sh public
deploy-prod: deploy-prod:
stage: deploy stage: deploy
......
This diff is collapsed.
...@@ -1272,8 +1272,7 @@ ...@@ -1272,8 +1272,7 @@
"commander": { "commander": {
"version": "2.20.0", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ=="
"dev": true
}, },
"component-bind": { "component-bind": {
"version": "1.0.0", "version": "1.0.0",
...@@ -8309,6 +8308,27 @@ ...@@ -8309,6 +8308,27 @@
"integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==",
"dev": true "dev": true
}, },
"uglify-js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
"requires": {
"commander": "~2.20.0",
"source-map": "~0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
}
}
},
"uglifycss": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz",
"integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ=="
},
"ultron": { "ultron": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
"browsersync" "browsersync"
], ],
"dependencies": { "dependencies": {
"purgecss": "^1.4.0" "purgecss": "^1.4.0",
"uglify-js": "^3.6.0",
"uglifycss": "0.0.29"
} }
} }
#!/bin/bash
sitedir="$1"
echo "Minifying JavaScript"
find "$sitedir" -type f \
-name "*.js" ! -name "*.min.*" ! -name "vfs_fonts*" \
-exec echo {} \; \
-exec ./node_modules/.bin/uglifyjs -o {}.min {} \; \
-exec rm {} \; \
-exec mv {}.min {} \;
echo "Minifying CSS"
find "$sitedir" -type f \
-name "*.css" ! -name "*.min.*" \
-exec echo {} \; \
-exec ./node_modules/.bin/uglifycss --output {}.min {} \; \
-exec rm {} \; \
-exec mv {}.min {} \;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment