MCPcopy
hub / github.com/tailwindlabs/tailwindcss / createCompiler

Function createCompiler

packages/@tailwindcss-postcss/src/index.ts:124–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122 let isInitialBuild = context.compiler === null
123
124 async function createCompiler() {
125 DEBUG && I.start('Setup compiler')
126 if (context.fullRebuildPaths.length > 0 && !isInitialBuild) {
127 clearRequireCache(context.fullRebuildPaths)
128 }
129
130 context.fullRebuildPaths = []
131
132 DEBUG && I.start('PostCSS AST -> Tailwind CSS AST')
133 let ast = postCssAstToCssAst(root)
134 DEBUG && I.end('PostCSS AST -> Tailwind CSS AST')
135
136 DEBUG && I.start('Create compiler')
137 let compiler = await compileAst(ast, {
138 from: result.opts.from,
139 base: inputBasePath,
140 shouldRewriteUrls,
141 onDependency: (path) => context.fullRebuildPaths.push(path),
142 // In CSS Module files, we have to disable the `@property` polyfill since these will
143 // emit global `*` rules which are considered to be non-pure and will cause builds
144 // to fail.
145 polyfills: isCSSModuleFile ? Polyfills.All ^ Polyfills.AtProperty : Polyfills.All,
146 })
147 DEBUG && I.end('Create compiler')
148
149 DEBUG && I.end('Setup compiler')
150 return compiler
151 }
152
153 try {
154 // Setup the compiler if it doesn't exist yet. This way we can

Callers 1

OnceFunction · 0.70

Calls 5

clearRequireCacheFunction · 0.90
postCssAstToCssAstFunction · 0.90
compileAstFunction · 0.90
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected