Move Makefile commands into npm scripts, the compress script is its own executable script file as too complex for single line
This commit is contained in:
parent
a377eb797d
commit
9f906a2de4
2 changed files with 66 additions and 35 deletions
23
compress
Normal file
23
compress
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/zsh
|
||||||
|
|
||||||
|
echo "compressing app.css and prism files"
|
||||||
|
zopfli ./public/assets/css/app.css
|
||||||
|
zopfli ./public/assets/prism/prism.css
|
||||||
|
zopfli ./public/assets/prism/prism.js
|
||||||
|
bro --force --quality 11 --input ./public/assets/css/app.css --output ./public/assets/css/app.css.br
|
||||||
|
bro --force --quality 11 --input ./public/assets/prism/prism.css --output ./public/assets/prism/prism.css.br
|
||||||
|
bro --force --quality 11 --input ./public/assets/prism/prism.js --output ./public/assets/prism/prism.js.br
|
||||||
|
|
||||||
|
echo "compressing js assets"
|
||||||
|
for file in ./public/assets/js/*.js
|
||||||
|
do
|
||||||
|
zopfli $file
|
||||||
|
bro --force --quality 11 --input $file --output $file.br
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "compressing frontend assets"
|
||||||
|
for file in ./public/assets/frontend/*.css
|
||||||
|
do
|
||||||
|
zopfli $file
|
||||||
|
bro --force --quality 11 --input $file --output $file.br
|
||||||
|
done
|
78
package.json
78
package.json
|
@ -1,37 +1,45 @@
|
||||||
{
|
{
|
||||||
"name": "jbuk-frontend",
|
"private": true,
|
||||||
"version": "0.0.1",
|
"name": "jbuk-frontend",
|
||||||
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
"version": "0.0.1",
|
||||||
"license": "CC0-1.0",
|
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
||||||
"dependencies": {
|
"license": "CC0-1.0",
|
||||||
"alertify.js": "^1.0.12",
|
"dependencies": {
|
||||||
"mapbox-gl": "^0.32.0",
|
"alertify.js": "^1.0.12",
|
||||||
"marked": "^0.3.6",
|
"mapbox-gl": "^0.32.0",
|
||||||
"normalize.css": "^5.0.0",
|
"marked": "^0.3.6",
|
||||||
"webStorage": "^1.2.2"
|
"normalize.css": "^5.0.0",
|
||||||
},
|
"webStorage": "^1.2.2"
|
||||||
"devDependencies": {
|
},
|
||||||
"babel-cli": "^6.18.0",
|
"devDependencies": {
|
||||||
"babel-core": "^6.21.0",
|
"babel-cli": "^6.18.0",
|
||||||
"babel-loader": "^6.2.10",
|
"babel-core": "^6.21.0",
|
||||||
"babel-preset-es2015": "^6.18.0",
|
"babel-loader": "^6.2.10",
|
||||||
"babel-preset-latest": "^6.16.0",
|
"babel-preset-es2015": "^6.18.0",
|
||||||
"babel-runtime": "^6.20.0",
|
"babel-preset-latest": "^6.16.0",
|
||||||
"lint-staged": "^3.2.1",
|
"babel-runtime": "^6.20.0",
|
||||||
"pre-commit": "^1.1.3",
|
"lint-staged": "^3.2.1",
|
||||||
"stylelint-config-standard": "^16.0.0",
|
"pre-commit": "^1.1.3",
|
||||||
"webpack": "^2.2.0"
|
"stylelint-config-standard": "^16.0.0",
|
||||||
},
|
"webpack": "^2.2.0"
|
||||||
"private": true,
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint-staged": "lint-staged",
|
"lint-staged": "lint-staged",
|
||||||
"stylelint-staged": "stylelint --syntax=scss"
|
"stylelint-staged": "stylelint --syntax=scss",
|
||||||
},
|
"eslint-staged": "eslint",
|
||||||
"lint-staged": {
|
"sass": "sassc --style compressed --sourcemap resources/assets/sass/app.scss public/assets/css/app.css",
|
||||||
"eslint": "resources/assets/js/*.js",
|
"postcss": "postcss --use autoprefixer --autoprefixer.browsers \"> 5%\" --output public/assets/css/app.css public/assets/css/app.css",
|
||||||
"stylelint-staged": "resources/assets/sass/**/*.scss"
|
"make:css": "npm run sass && npm run postcss",
|
||||||
},
|
"compress": "./compress",
|
||||||
"pre-commit": [
|
"copy-dist": "cp ./node_modules/mapbox-gl/dist/mapbox-gl.css ./public/assets/frontend/ && cp ./node_modules/alertify.js/dist/css/alertify.css ./public/assets/frontend/ && cp ./node_modules/normalize.css/normalize.css ./public/assets/frontend/",
|
||||||
"lint-staged"
|
"lint:sass": "stylelint --syntax=scss resources/assets/sass/**/*.scss",
|
||||||
]
|
"lint:es6": "eslint resources/assets/es6/*.js"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"eslint-staged": "resources/assets/es6/*.js",
|
||||||
|
"stylelint-staged": "resources/assets/sass/**/*.scss"
|
||||||
|
},
|
||||||
|
"pre-commit": [
|
||||||
|
"lint-staged"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue