mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 18:36:51 +08:00
15 lines
372 B
TypeScript
15 lines
372 B
TypeScript
import less from 'less';
|
|
import { join } from 'path';
|
|
import { readFileSync } from 'fs';
|
|
import { CWD } from '../common/constant.js';
|
|
|
|
export async function compileLess(filePath: string) {
|
|
const source = readFileSync(filePath, 'utf-8');
|
|
const { css } = await less.render(source, {
|
|
filename: filePath,
|
|
paths: [join(CWD, 'node_modules')],
|
|
});
|
|
|
|
return css;
|
|
}
|