Add a build script

This commit is contained in:
Erick Ruiz de Chavez 2022-04-29 17:45:37 -04:00
parent bb6940b834
commit 6ed5ebd304
No known key found for this signature in database
GPG key ID: 18853A33FA62DDC9
2 changed files with 13 additions and 6 deletions

11
build.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
rm -rf dist && mkdir dist
npx tailwindcss -i tailwind.css -o dist/styles.css --minify
hash=$(shasum dist/styles.css | awk '{print $1}')
new_file="styles.$hash.css"
mv dist/styles.css dist/$new_file
sed "s/styles\.css/$new_file/" index.html > dist/index.html

View file

@ -3,12 +3,8 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"scripts": { "scripts": {
"browserslist": "npx browserslist@latest --update-db -y",
"build": "npm run clean && npm run browserslist && npm run tailwind && npm run copy",
"clean": "rm -rf dist && mkdir dist",
"copy": "cp index.html dist/",
"start": "tailwindcss -i tailwind.css -o styles.css -m --watch", "start": "tailwindcss -i tailwind.css -o styles.css -m --watch",
"tailwind": "tailwindcss -i tailwind.css -o dist/styles.css --minify" "build": "./build.sh"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,7 +16,7 @@
"bugs": { "bugs": {
"url": "https://github.com/eruizdechavez/sinsaludar.com/issues" "url": "https://github.com/eruizdechavez/sinsaludar.com/issues"
}, },
"homepage": "https://sinsaludar.com", "homepage": "https://www.sinsaludar.com",
"devDependencies": { "devDependencies": {
"tailwindcss": "^2.2.15" "tailwindcss": "^2.2.15"
} }