createServer() — tailwindcss Function Reference
Architecture documentation for the createServer() function in ui.spec.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 167b424b_6941_4cdf_593e_c09edc4aaf68["createServer()"] 0301f650_9cea_ed7e_92e4_ef769602f689["ui.spec.ts"] 167b424b_6941_4cdf_593e_c09edc4aaf68 -->|defined in| 0301f650_9cea_ed7e_92e4_ef769602f689 style 167b424b_6941_4cdf_593e_c09edc4aaf68 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/@tailwindcss-browser/tests/ui.spec.ts lines 104–171
async function createServer() {
const { createApp, createRouter, defineEventHandler, toNodeListener } = await import('h3')
const { listen } = await import('listhen')
interface PageOptions {
page: Page
head?: string
body?: string
htmlClasses?: string
}
async function render({ page, htmlClasses, head, body }: PageOptions) {
let content = html`
<!doctype html>
<html lang="en" class="${htmlClasses ?? ''}">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="/tailwindcss.js"></script>
<style type="text/tailwindcss">
@theme {
--color-red: #ff0000;
--color-green: #00ff00;
--color-blue: #0000ff;
}
</style>
${head ?? ''}
</head>
<body>
${body ?? ''}
</body>
</html>
`
router.get(
'/',
defineEventHandler(() => content),
)
await page.goto(server.url)
}
const app = createApp()
const router = createRouter()
router.get(
'/tailwindcss.js',
defineEventHandler(() => readFile(require.resolve('@tailwindcss/browser'))),
)
app.use(router)
let workerIndex = Number(process.env.TEST_WORKER_INDEX ?? 0)
let listener = await listen(toNodeListener(app), {
port: 3000 + workerIndex,
showURL: false,
open: false,
})
return {
app,
url: listener.url,
render,
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does createServer() do?
createServer() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-browser/tests/ui.spec.ts.
Where is createServer() defined?
createServer() is defined in packages/@tailwindcss-browser/tests/ui.spec.ts at line 104.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free