mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
fix: responsive fix
This commit is contained in:
@@ -1,20 +1,14 @@
|
||||
import postcssPlugin from "postcss";
|
||||
import tailwindcss from "tailwindcss";
|
||||
import cssnano from "cssnano";
|
||||
import { fileExists, getProjectDir } from "~/server/lib/utils";
|
||||
import { FileSchema } from "~/server/db/schema/file";
|
||||
import { unpackProject } from "~/server/lib/unpack-project";
|
||||
|
||||
export const postcss = async (fileData: FileSchema) => {
|
||||
const content = fileData.content || "";
|
||||
|
||||
const projectDir = getProjectDir();
|
||||
if (!fileExists(projectDir)) {
|
||||
return content;
|
||||
}
|
||||
|
||||
try {
|
||||
await unpackProject({ ext: "ts,tsx,js,jsx,html" });
|
||||
const projectDir = await unpackProject({ ext: "ts,tsx,js,jsx,html" });
|
||||
|
||||
const result = await postcssPlugin([
|
||||
tailwindcss({
|
||||
@@ -29,6 +23,7 @@ export const postcss = async (fileData: FileSchema) => {
|
||||
|
||||
return result.css;
|
||||
} catch (err) {
|
||||
console.error("postcss error", err);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
+16
-16
@@ -66,22 +66,22 @@ const main = async () => {
|
||||
path: "index.html",
|
||||
filename: "index.html",
|
||||
content: `<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
/>
|
||||
<title>React + Tailwind Template</title>
|
||||
<link rel="stylesheet" href="globals.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="index.jsx" type="module" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
`,
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
/>
|
||||
<title>React + Tailwind Template</title>
|
||||
<link rel="stylesheet" href="globals.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="index.jsx" type="module" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
`,
|
||||
},
|
||||
{
|
||||
userId: adminUser.id,
|
||||
|
||||
@@ -23,6 +23,7 @@ export const unpackProject = async (
|
||||
|
||||
const projectDir = getProjectDir();
|
||||
if (!fileExists(projectDir)) {
|
||||
console.log("not exist", projectDir);
|
||||
await fs.mkdir(projectDir, { recursive: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user