source: frontend/node_modules/tailwindcss/src/plugin.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[9af201e]1import setupTrackingContext from './lib/setupTrackingContext'
2import processTailwindFeatures from './processTailwindFeatures'
3import { env } from './lib/sharedState'
4import { findAtConfigPath } from './lib/findAtConfigPath'
5
6module.exports = function tailwindcss(configOrPath) {
7 return {
8 postcssPlugin: 'tailwindcss',
9 plugins: [
10 env.DEBUG &&
11 function (root) {
12 console.log('\n')
13 console.time('JIT TOTAL')
14 return root
15 },
16 async function (root, result) {
17 // Use the path for the `@config` directive if it exists, otherwise use the
18 // path for the file being processed
19 configOrPath = findAtConfigPath(root, result) ?? configOrPath
20
21 let context = setupTrackingContext(configOrPath)
22
23 if (root.type === 'document') {
24 let roots = root.nodes.filter((node) => node.type === 'root')
25
26 for (const root of roots) {
27 if (root.type === 'root') {
28 await processTailwindFeatures(context)(root, result)
29 }
30 }
31
32 return
33 }
34
35 await processTailwindFeatures(context)(root, result)
36 },
37 env.DEBUG &&
38 function (root) {
39 console.timeEnd('JIT TOTAL')
40 console.log('\n')
41 return root
42 },
43 ].filter(Boolean),
44 }
45}
46
47module.exports.postcss = true
Note: See TracBrowser for help on using the repository browser.