Change image processing

This commit is contained in:
Robbie Antenesse 2019-09-08 21:45:35 -06:00
parent d5de474368
commit 79c812c684
3 changed files with 12 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules/
public/ public/
.cache/ .cache/
dist/ dist/
dev/
**/*.log **/*.log
config.json config.json

View File

@ -7,14 +7,14 @@
"author": "Robbie Antenesse <dev@alamantus.com>", "author": "Robbie Antenesse <dev@alamantus.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"install": "npm run process-images",
"dev": "npm run watch-js", "dev": "npm run watch-js",
"start": "npm run build && npm run serve", "start": "npm run build && npm run serve",
"watch-js": "parcel watch app/index.html --out-dir public --no-hmr --no-cache", "watch-js": "parcel watch app/index.html --out-dir public --no-hmr --no-cache",
"serve": "node server/index.js", "serve": "node server/index.js",
"build": "parcel build app/index.html --out-dir public --no-source-maps", "build": "parcel build app/index.html --out-dir public --no-source-maps --no-cache",
"clear": "npm run clear-dist && npm run clear-cache", "process-images": "node ./process-images.js",
"clear-dist": "rimraf dist/{*,.*}", "clear": "rimraf public/{*,.*}"
"clear-cache": "rimraf .cache/{*,.*}"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^9.6.1", "autoprefixer": "^9.6.1",
@ -27,8 +27,8 @@
"sharp": "^0.23.0" "sharp": "^0.23.0"
}, },
"dependencies": { "dependencies": {
"cross-env": "^5.2.1",
"choo": "^7.0.0", "choo": "^7.0.0",
"cross-env": "^5.2.1",
"fastify": "^2.8.0", "fastify": "^2.8.0",
"fastify-caching": "^5.0.0", "fastify-caching": "^5.0.0",
"fastify-compress": "^0.11.0", "fastify-compress": "^0.11.0",

View File

@ -1,16 +1,16 @@
const fs = require('fs'); const fs = require('fs');
const sharp = require('sharp'); const sharp = require('sharp');
const folder = './public/images/'; const folder = './dev/images/';
if (!fs.existsSync('./public')) { if (!fs.existsSync('./dev')) {
fs.mkdirSync('./public'); fs.mkdirSync('./dev');
} }
if (!fs.existsSync('./public/images')) { if (!fs.existsSync('./dev/images')) {
fs.mkdirSync('./public/images'); fs.mkdirSync('./dev/images');
} }
const favicon = sharp('./images/book-pile.svg'); const favicon = sharp('./app/images/book-pile.svg');
// sharp('./src/images/social.jpg').toFile(folder + 'social.jpg', (err, info) => { // sharp('./src/images/social.jpg').toFile(folder + 'social.jpg', (err, info) => {
// if (err) return console.error(err); // if (err) return console.error(err);