Skip to content

Commit 60ee3d9

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent e2d87e7 commit 60ee3d9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@vue/compiler-sfc": "^3.4.19",
1515
"laravel-mix": "^6.0.49",
1616
"postcss": "^8.4.35",
17+
"postcss-import": "^14.0.2",
1718
"prettier-plugin-tailwindcss": "^0.5.9",
1819
"vue-loader": "^16.8.3"
1920
}

unique.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
let postcss = require('postcss')
2+
let fs = require('fs')
3+
4+
module.exports = (options = {}) => {
5+
let selectors = new Set()
6+
7+
postcss.parse(fs.readFileSync(options.path)).walkRules(rule => {
8+
selectors.add(rule.selector)
9+
})
10+
11+
return {
12+
postcssPlugin: 'unique',
13+
14+
Rule(rule) {
15+
if (selectors.has(rule.selector)) {
16+
rule.remove()
17+
}
18+
},
19+
}
20+
}
21+
22+
module.exports.postcss = true

0 commit comments

Comments
 (0)