mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 13:39:30 +08:00
42 lines
1.1 KiB
Text
42 lines
1.1 KiB
Text
import setupTrackingContext from './lib/setupTrackingContext'
|
|
import processTailwindFeatures from './processTailwindFeatures'
|
|
import { env } from './lib/sharedState'
|
|
|
|
module.exports = function tailwindcss(configOrPath) {
|
|
return {
|
|
postcssPlugin: 'tailwindcss',
|
|
plugins: [
|
|
env.DEBUG &&
|
|
function (root) {
|
|
console.log('\n')
|
|
console.time('JIT TOTAL')
|
|
return root
|
|
},
|
|
function (root, result) {
|
|
let context = setupTrackingContext(configOrPath)
|
|
|
|
if (root.type === 'document') {
|
|
let roots = root.nodes.filter((node) => node.type === 'root')
|
|
|
|
for (const root of roots) {
|
|
if (root.type === 'root') {
|
|
processTailwindFeatures(context)(root, result)
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
processTailwindFeatures(context)(root, result)
|
|
},
|
|
env.DEBUG &&
|
|
function (root) {
|
|
console.timeEnd('JIT TOTAL')
|
|
console.log('\n')
|
|
return root
|
|
},
|
|
].filter(Boolean),
|
|
}
|
|
}
|
|
|
|
module.exports.postcss = true
|