@jamessw
2 public vals
Joined September 12, 2023
1
2
3
4
5
6
7
8
9
let postSass = async (request: Request): Promise<Response> => {
const body = await request.text();
const res = await jamessw.sass({
input: body,
});
return new Response(res, {
headers: { "Content-Type": "text/plain" },
});
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
interface SassArgs {
input: string;
}
export async function sass(args: SassArgs) {
const input = args.input || "a {color: #663399}";
const sass = await import("https://jspm.dev/sass");
const res = sass.compileString(input);
if (res.css) {
return res.css;
}
else {
throw res;
}
}