diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 00000000..1e22713b --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "rx-resume" + } +} diff --git a/.gitignore b/.gitignore index 4d29575d..1a857168 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ # production /build +# firebase +.firebase + # misc .DS_Store .env.local diff --git a/firebase.json b/firebase.json new file mode 100644 index 00000000..340ed5b7 --- /dev/null +++ b/firebase.json @@ -0,0 +1,16 @@ +{ + "hosting": { + "public": "build", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} diff --git a/package-lock.json b/package-lock.json index ab014ecc..b7c9953b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1082,6 +1082,16 @@ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" }, + "@fullhuman/postcss-purgecss": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-2.1.0.tgz", + "integrity": "sha512-zmV+cK8pAo/suKMQk1fKzDdols5ltOy86Hk51qwkiJJt4olm3t1MaUrm4U4MlA9fiYeRpLqsNop2xNoEm8DV+w==", + "dev": true, + "requires": { + "postcss": "7.0.27", + "purgecss": "^2.1.0" + } + }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -11241,6 +11251,26 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "purgecss": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-2.1.0.tgz", + "integrity": "sha512-QnXhowNjeWo9vNnGES2LVzDXdRR/8EvG/O03m4bYOWfAX0ShmG/Pmj7brVtVBy2eaaRAmNy23L+GBc4SpDFUeQ==", + "dev": true, + "requires": { + "commander": "^4.0.0", + "glob": "^7.0.0", + "postcss": "7.0.27", + "postcss-selector-parser": "^6.0.2" + }, + "dependencies": { + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true + } + } + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", diff --git a/package.json b/package.json index 6e044c58..99f29582 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,15 @@ }, "scripts": { "css": "postcss src/assets/tailwind/tailwind.src.css -o src/assets/tailwind/tailwind.css", + "css:prod": "postcss src/assets/tailwind/tailwind.src.css -o src/assets/tailwind/tailwind.css --env production", "prestart": "npm run css", "start": "react-scripts start", - "prebuild": "npm run css", - "build": "react-scripts build", + "prebuild": "npm run css:prod", + "build": "NODE_ENV=production react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "predeploy": "npm run build", + "deploy": "firebase deploy" }, "eslintConfig": { "extends": "react-app" @@ -39,6 +42,7 @@ ] }, "devDependencies": { + "@fullhuman/postcss-purgecss": "^2.1.0", "autoprefixer": "^9.7.5", "eslint": "^6.8.0", "eslint-config-airbnb": "^18.1.0", @@ -51,4 +55,4 @@ "postcss-cli": "^7.1.0", "tailwindcss": "^1.2.0" } -} +} \ No newline at end of file diff --git a/postcss.config.js b/postcss.config.js index 8c8431fc..629871f7 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,15 @@ -const tailwindcss = require('tailwindcss'); +/* eslint-disable global-require */ +/* eslint-disable import/no-extraneous-dependencies */ + +const purgecss = require('@fullhuman/postcss-purgecss')({ + content: ['./public/index.html', './src/**/*.js'], + defaultExtractor: content => content.match(/[\w-/:]+(?