mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
feat: add sandbox
This commit is contained in:
@@ -45,7 +45,7 @@ const get = async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
if (["css"].includes(ext) && settings.css?.preprocessor === "postcss") {
|
||||
content = await postcss(fileData, settings.css);
|
||||
content = await postcss(projectData, fileData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ import tailwindcss from "tailwindcss";
|
||||
import cssnano from "cssnano";
|
||||
import { FileSchema } from "~/server/db/schema/file";
|
||||
import { unpackProject } from "~/server/lib/unpack-project";
|
||||
import { ProjectSettingsSchema } from "~/server/db/schema/project";
|
||||
import { ProjectSchema } from "~/server/db/schema/project";
|
||||
|
||||
export const postcss = async (
|
||||
fileData: FileSchema,
|
||||
cfg?: ProjectSettingsSchema["css"]
|
||||
) => {
|
||||
export const postcss = async (project: ProjectSchema, fileData: FileSchema) => {
|
||||
const content = fileData.content || "";
|
||||
const cfg = project.settings?.css;
|
||||
|
||||
try {
|
||||
const projectDir = await unpackProject({ ext: "ts,tsx,js,jsx,html" });
|
||||
const projectDir = await unpackProject(project, {
|
||||
ext: "ts,tsx,js,jsx,html",
|
||||
});
|
||||
const plugins: any[] = [];
|
||||
|
||||
if (cfg?.tailwindcss) {
|
||||
|
||||
Reference in New Issue
Block a user