UNPKG

to-unocss

Version:

Vscode extension transform css to unocss

27 lines 780 B
import { transfromCode } from 'transform-to-unocss'; import { getCssType, getMultipedUnocssText } from './utils'; export class CssToUnocssProcess { /** * transform px to rpx * * @param {string} code origin text * @return {string} transformed text */ convert(text) { return getMultipedUnocssText(text) ?? text; } /** * transform all px to rpx * * @param {string} code origin text * @return {string} transformed text */ async convertAll(code, fileName) { if (!code) return code; const type = getCssType(fileName); const unocss = (await transfromCode(code, fileName, type)) ?? code; return unocss; } } //# sourceMappingURL=process.js.map