diff --git a/package.json b/package.json index 579bcdb..a813769 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "vue": "^2.6.6" }, "devDependencies": { + "@fullhuman/postcss-purgecss": "^1.2.0", "@vue/cli-plugin-babel": "^3.5.1", "@vue/cli-plugin-eslint": "^3.5.1", "@vue/cli-service": "^3.5.1", diff --git a/postcss.config.js b/postcss.config.js index 5efa5f9..e29a098 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,7 +1,14 @@ module.exports = { - parser: 'sugarss', - plugins: { - tailwindcss: './tailwind.config.js', - autoprefixer: {} - } + plugins: [ + require('tailwindcss'), + 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/yarn.lock b/yarn.lock index 774f84a..af3aa39 100644 --- a/yarn.lock +++ b/yarn.lock @@ -670,6 +670,14 @@ lodash "^4.17.13" to-fast-properties "^2.0.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" @@ -6538,6 +6546,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" @@ -8447,7 +8465,7 @@ yargs@12.0.5: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -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==