MCPcopy Create free account
hub / github.com/TanStack/query / inlineCss

Function inlineCss

packages/query-devtools/tsdown.config.ts:35–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33// Loads `./styles.css?inline` as a string, as Vite does in the tests. The CSS
34// is not minified by the JS minifier, so remove comments and extra whitespace.
35const inlineCss = () => ({
36 name: 'inline-css',
37 resolveId(id: string, importer?: string) {
38 if (id.endsWith('.css?inline') && importer) {
39 return resolve(dirname(importer), id)
40 }
41 return undefined
42 },
43 load(id: string) {
44 if (!id.endsWith('.css?inline')) return undefined
45 const css = readFileSync(id.slice(0, -'?inline'.length), 'utf8')
46 .replace(/\/\*[\s\S]*?\*\//g, '')
47 .replace(/\s+/g, ' ')
48 .replace(/ ?([{};]) ?/g, '$1')
49 .trim()
50 return { code: `export default ${JSON.stringify(css)}`, moduleType: 'js' }
51 },
52})
53
54const baseConfig: UserConfig = {
55 target: 'esnext',

Callers 1

tsdown.config.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected