mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-14 23:52:28 +03:00
add server tests, improve readme and types
This commit is contained in:
@@ -16,32 +16,34 @@ export const esbuildPluginTailwind = ({
|
||||
build.onEnd(async (result) => {
|
||||
if (result) {
|
||||
const { metafile, outputFiles } = result;
|
||||
const { inputs } = metafile;
|
||||
const tailwindFile = outputFiles.find(({ path: outputFilePath }) =>
|
||||
tailwindCssFileRegex.test(outputFilePath)
|
||||
);
|
||||
|
||||
if (tailwindFile) {
|
||||
const { path: tailwindFilePath, text: tailwindFileCss } = tailwindFile;
|
||||
const tailwindContentGlobs = (resolvedTailwindConfig?.content || []).filter(
|
||||
(entry) => typeof entry === 'string'
|
||||
);
|
||||
const inputFilePaths = Object.keys(inputs).map((input) => path.resolve(input));
|
||||
const includedFiles = Array.from(
|
||||
new Set(
|
||||
tailwindContentGlobs
|
||||
.map((glob) => minimatch.match(inputFilePaths, glob, { dot: true }))
|
||||
.flat()
|
||||
)
|
||||
if (metafile && outputFiles) {
|
||||
const { inputs } = metafile;
|
||||
const tailwindFile = outputFiles.find(({ path: outputFilePath }) =>
|
||||
tailwindCssFileRegex.test(outputFilePath)
|
||||
);
|
||||
|
||||
const postcssResult = await postcss([
|
||||
tailwindcss({ ...(resolvedTailwindConfig || {}), content: includedFiles }),
|
||||
]).process(tailwindFileCss, {
|
||||
from: tailwindFilePath,
|
||||
});
|
||||
if (tailwindFile) {
|
||||
const { path: tailwindFilePath, text: tailwindFileCss } = tailwindFile;
|
||||
const tailwindContentGlobs = (resolvedTailwindConfig?.content || []).filter(
|
||||
(entry) => typeof entry === 'string'
|
||||
);
|
||||
const inputFilePaths = Object.keys(inputs).map((input) => path.resolve(input));
|
||||
const includedFiles = Array.from(
|
||||
new Set(
|
||||
tailwindContentGlobs
|
||||
.map((glob) => minimatch.match(inputFilePaths, glob, { dot: true }))
|
||||
.flat()
|
||||
)
|
||||
);
|
||||
|
||||
tailwindFile.contents = Buffer.from(postcssResult.css);
|
||||
const postcssResult = await postcss([
|
||||
tailwindcss({ ...(resolvedTailwindConfig || {}), content: includedFiles }),
|
||||
]).process(tailwindFileCss, {
|
||||
from: tailwindFilePath,
|
||||
});
|
||||
|
||||
tailwindFile.contents = Buffer.from(postcssResult.css);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user