UNPKG

exexcepturi

Version:

css-to-ts takes css file and outputs TypeScript file with an exported string containing content of your css file.

10 lines (7 loc) 343 B
import { EOL } from "os"; export function ConvertCssToTs(stringifiedCss: string, variableName: string, headerComment?: string): string { let tsContent = ""; if (headerComment) { tsContent += `// ${headerComment}${EOL}`; } tsContent += `export var ${variableName} = \`${stringifiedCss}\`;${EOL}`; return tsContent; }