Manually remove unused font-awesome classes

This commit is contained in:
Alessandro Pignotti 2024-10-06 09:03:13 +02:00
parent a838ffc97a
commit ed52c12a83
3 changed files with 58 additions and 0 deletions

40
package-lock.json generated
View file

@ -23,6 +23,7 @@
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"labs": "git@github.com:leaningtech/labs.git", "labs": "git@github.com:leaningtech/labs.git",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"postcss-discard": "^2.0.0",
"rollup-plugin-copy": "^3.5.0", "rollup-plugin-copy": "^3.5.0",
"rollup-plugin-css-only": "^4.3.0", "rollup-plugin-css-only": "^4.3.0",
"rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss": "^4.0.2",
@ -1476,6 +1477,18 @@
"node": ">= 6" "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": { "node_modules/code-red": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz", "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
@ -2468,6 +2481,18 @@
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"dev": true "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": { "node_modules/lodash.memoize": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@ -2890,6 +2915,21 @@
"postcss": "^8.2.15" "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": { "node_modules/postcss-discard-comments": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz",

View file

@ -22,6 +22,7 @@
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"labs": "git@github.com:leaningtech/labs.git", "labs": "git@github.com:leaningtech/labs.git",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"postcss-discard": "^2.0.0",
"rollup-plugin-copy": "^3.5.0", "rollup-plugin-copy": "^3.5.0",
"rollup-plugin-css-only": "^4.3.0", "rollup-plugin-css-only": "^4.3.0",
"rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss": "^4.0.2",

View file

@ -7,6 +7,7 @@ import terser from '@rollup/plugin-terser';
import resolve from '@rollup/plugin-node-resolve'; import resolve from '@rollup/plugin-node-resolve';
import css from 'rollup-plugin-css-only'; import css from 'rollup-plugin-css-only';
import autoprefixer from 'autoprefixer'; import autoprefixer from 'autoprefixer';
import discard from 'postcss-discard';
import path from 'path'; import path from 'path';
import url from 'url'; import url from 'url';
import tailwindcss from 'tailwindcss'; import tailwindcss from 'tailwindcss';
@ -43,6 +44,22 @@ export default {
plugins: [ plugins: [
tailwindcss, tailwindcss,
autoprefixer, 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;
}})
], ],
}), }),