diff --git a/package-lock.json b/package-lock.json index c60c65f..eee8cd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "autoprefixer": "^10.4.20", "labs": "git@github.com:leaningtech/labs.git", "postcss": "^8.4.47", + "postcss-discard": "^2.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-postcss": "^4.0.2", @@ -1476,6 +1477,18 @@ "node": ">= 6" } }, + "node_modules/clean-css": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", + "dev": true, + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, "node_modules/code-red": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz", @@ -2468,6 +2481,18 @@ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "dev": true }, + "node_modules/lodash.isfunction": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", + "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", + "dev": true + }, + "node_modules/lodash.isregexp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isregexp/-/lodash.isregexp-4.0.1.tgz", + "integrity": "sha512-rw9+95tYcUa9nQ1FgdtKvO+hReLGNqnNMHfLq8SwK5Mo6D0R0tIsnRHGHaTHSKeYBaLCJ1JvXWdz4UmpPZ2bag==", + "dev": true + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -2890,6 +2915,21 @@ "postcss": "^8.2.15" } }, + "node_modules/postcss-discard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard/-/postcss-discard-2.0.0.tgz", + "integrity": "sha512-M7e1ckqMd3r0THkY4zTIRKP3H2NUrsNsI7UuIUYbyFDPRD26QgFR/BGGw8CNt5X4F0uGBnAMAFGgktraPdOZFw==", + "dev": true, + "dependencies": { + "clean-css": "^5.1.2", + "lodash.isfunction": "^3.0.9", + "lodash.isregexp": "^4.0.1", + "postcss": "^8.3.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/postcss-discard-comments": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", diff --git a/package.json b/package.json index 99945d6..bda1d8e 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "autoprefixer": "^10.4.20", "labs": "git@github.com:leaningtech/labs.git", "postcss": "^8.4.47", + "postcss-discard": "^2.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-postcss": "^4.0.2", diff --git a/rollup.config.js b/rollup.config.js index 3c3adfd..84a303c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,6 +7,7 @@ import terser from '@rollup/plugin-terser'; import resolve from '@rollup/plugin-node-resolve'; import css from 'rollup-plugin-css-only'; import autoprefixer from 'autoprefixer'; +import discard from 'postcss-discard'; import path from 'path'; import url from 'url'; import tailwindcss from 'tailwindcss'; @@ -43,6 +44,22 @@ export default { plugins: [ tailwindcss, autoprefixer, + discard({rule: function(node, value) + { + if(!value.startsWith('.fa-') || !value.endsWith(":before")) + return false; + switch(value) + { + case '.fa-info-circle:before': + case '.fa-wifi:before': + case '.fa-microchip:before': + case '.fa-compact-disc:before': + case '.fa-discord:before': + case '.fa-github:before': + return false; + } + return true; + }}) ], }),