diff --git a/package.json b/package.json index ac5dc95..4b54401 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", + "@fullhuman/postcss-purgecss": "^1.2.0", "@vue/cli-plugin-babel": "^3.5.1", "@vue/cli-plugin-eslint": "^3.5.1", "@vue/cli-plugin-unit-jest": "^3.5.3", diff --git a/postcss.config.js b/postcss.config.js index c1b627a..5dfe754 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,9 +1,16 @@ module.exports = { parser: 'sugarss', - plugins: { - 'postcss-import': {}, - tailwindcss: './tailwind.config.js', - 'postcss-nested': {}, - autoprefixer: {} - } + plugins: [ + require('postcss-import'), + require('tailwindcss'), + require('postcss-nested'), + require('autoprefixer'), + process.env.NODE_ENV === 'production' && require('@fullhuman/postcss-purgecss')({ + content: [ + './src/**/*.vue', + './public/index.html', + ], + defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [] + }) + ] } diff --git a/src/assets/css/custom-base.css b/src/assets/css/base.css similarity index 100% rename from src/assets/css/custom-base.css rename to src/assets/css/base.css diff --git a/src/assets/css/custom-components.css b/src/assets/css/components.css similarity index 100% rename from src/assets/css/custom-components.css rename to src/assets/css/components.css diff --git a/src/assets/css/tailwind.css b/src/assets/css/tailwind.css index 3e5a830..35cbf6c 100644 --- a/src/assets/css/tailwind.css +++ b/src/assets/css/tailwind.css @@ -1,7 +1,7 @@ @import 'tailwindcss/base' -@import 'custom-base' +@import './base.css' @import 'tailwindcss/components' -@import 'custom-components' +@import './components.css' @import 'tailwindcss/utilities' diff --git a/yarn.lock b/yarn.lock index 4f7f353..cf8d117 100644 --- a/yarn.lock +++ b/yarn.lock @@ -763,6 +763,14 @@ exec-sh "^0.3.2" minimist "^1.2.0" +"@fullhuman/postcss-purgecss@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@fullhuman/postcss-purgecss/-/postcss-purgecss-1.2.0.tgz#a3207a0e1812f8b56fa49fba5796a1020f2756a8" + integrity sha512-An05jbnZVUrX+VVNniaNQtOuo/S7tyQu5x86itXTF+7kfMaGxglFGykFX2KCt2hcbJijbvfCval9IkPO19V1KA== + dependencies: + postcss "^7.0.14" + purgecss "^1.3.0" + "@hapi/address@2.x.x": version "2.0.0" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a" @@ -8719,6 +8727,16 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +purgecss@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/purgecss/-/purgecss-1.3.0.tgz#fc3c303df9a74a75547545b2c0da28a9ec63da00" + integrity sha512-0UMnr8aUsPO7RbzAT72UELRvwMHhadtuunDm7rcgRS6b8pCVO8yglIqikiYFwQk2XP606mk+GpjI1G74Auxgtg== + dependencies: + glob "^7.1.3" + postcss "^7.0.14" + postcss-selector-parser "^6.0.0" + yargs "^13.2.2" + q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -11032,7 +11050,7 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yargs@^13.0.0: +yargs@^13.0.0, yargs@^13.2.2: version "13.3.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==