Skip to content

Commit

Permalink
chore(vulnerability):purge css issues
Browse files Browse the repository at this point in the history
  • Loading branch information
divyadaglia-unbxd committed Jul 19, 2023
1 parent cf6cd10 commit 1502b54
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"dependencies": {
"@babel/plugin-transform-runtime": "^7.22.6",
"@unbxd-ui/unbxd-search-core": "0.4.33",
"postcss": "8.4.26",
"postcss": "8.2.13",
"sass": "^1.63.6",
"style-loader": "3.3.3",
"yarn": "^1.22.19"
Expand Down
15 changes: 8 additions & 7 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const tailwindcss = require('tailwindcss');
const whiteListClasses = require('./src/config/whiteListClasses');
const purgecss = require('@fullhuman/postcss-purgecss')

module.exports = {
plugins: [
tailwindcss('./tailwind.config.js'),
require('autoprefixer'),
require('@fullhuman/postcss-purgecss')({
content: ['./src/**/*.js'],
defaultExtractor: (content) =>
content.match(/[\w-/:]+(?<!:)/g) || [],
whitelist: whiteListClasses
})
require('autoprefixer')
// purgecss({
// content: ["./src/**/*.js", "./demo/src/**/*.js"],
// css: ["./public/css/**/*.css"],
// defaultExtractor: content => content.match(/[\w-./:]+(?<!:)/g) || [],
// safelist: whiteListClasses
// }),
]
};
4 changes: 2 additions & 2 deletions report.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"high": 0,
"critical": 0
},
"dependencies": 2092,
"dependencies": 2094,
"devDependencies": 0,
"optionalDependencies": 0,
"totalDependencies": 2092
"totalDependencies": 2094
}
}
2 changes: 1 addition & 1 deletion src/config/whiteListClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ const gridCols = [...Array(13).keys()]
.slice(1)
.map((item) => `grid-cols-${item}`);
whiteListClasses.push(...gridCols);

whiteListClasses.push("body");
module.exports = whiteListClasses;
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
content: ['./demo/','./src/','./demo/public/index.html', './public/css/core/*.scss'
],
target: 'relaxed',
prefix: 'tw-',
prefix: '',
important: false,
separator: ':',
theme: {
Expand Down
1 change: 1 addition & 0 deletions webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module.exports = {
use: [
'style-loader',
'css-loader',
'postcss-loader',
// {
// loader: 'postcss-loader',
// options: {
Expand Down
30 changes: 22 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4504,6 +4504,11 @@ color@^3.0.0:
color-convert "^1.9.3"
color-string "^1.6.0"

colorette@^1.2.2:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40"
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==

colorette@^2.0.10, colorette@^2.0.14:
version "2.0.20"
resolved "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz"
Expand Down Expand Up @@ -9659,7 +9664,7 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

nanoid@^3.3.6:
nanoid@^3.1.22, nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
Expand Down Expand Up @@ -10817,14 +10822,14 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.0.2, postcss-value-parser@^
resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz"
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==

postcss@8.4.26, postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.4:
version "8.4.26"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.26.tgz#1bc62ab19f8e1e5463d98cf74af39702a00a9e94"
integrity sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==
postcss@8.2.13:
version "8.2.13"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.13.tgz#dbe043e26e3c068e45113b1ed6375d2d37e2129f"
integrity sha512-FCE5xLH+hjbzRdpbRb1IMCvPv9yZx2QnDarBEYSN0N0HYk+TcXsEhwdFcFb+SRWOKzKGErhIEbBK2ogyLdTtfQ==
dependencies:
nanoid "^3.3.6"
picocolors "^1.0.0"
source-map-js "^1.0.2"
colorette "^1.2.2"
nanoid "^3.1.22"
source-map "^0.6.1"

postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.27:
version "7.0.39"
Expand All @@ -10834,6 +10839,15 @@ postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.27:
picocolors "^0.2.1"
source-map "^0.6.1"

postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.4:
version "8.4.26"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.26.tgz#1bc62ab19f8e1e5463d98cf74af39702a00a9e94"
integrity sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==
dependencies:
nanoid "^3.3.6"
picocolors "^1.0.0"
source-map-js "^1.0.2"

prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
Expand Down

0 comments on commit 1502b54

Please sign in to comment.