mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(cli): emit path of compile failed style
This commit is contained in:
parent
5ebb2fffd3
commit
cee0bfa0e1
@ -4,22 +4,28 @@ import { replaceExt } from '../common';
|
|||||||
import { compileCss } from './compile-css';
|
import { compileCss } from './compile-css';
|
||||||
import { compileLess } from './compile-less';
|
import { compileLess } from './compile-less';
|
||||||
import { compileSass } from './compile-sass';
|
import { compileSass } from './compile-sass';
|
||||||
|
import { logger } from '../common/logger';
|
||||||
|
|
||||||
async function compileFile(filePath: string) {
|
async function compileFile(filePath: string) {
|
||||||
const parsedPath = parse(filePath);
|
const parsedPath = parse(filePath);
|
||||||
|
|
||||||
if (parsedPath.ext === '.less') {
|
try {
|
||||||
const source = await compileLess(filePath);
|
if (parsedPath.ext === '.less') {
|
||||||
return compileCss(source);
|
const source = await compileLess(filePath);
|
||||||
}
|
return await compileCss(source);
|
||||||
|
}
|
||||||
|
|
||||||
if (parsedPath.ext === '.scss') {
|
if (parsedPath.ext === '.scss') {
|
||||||
const source = await compileSass(filePath);
|
const source = await compileSass(filePath);
|
||||||
return compileCss(source);
|
return await compileCss(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = readFileSync(filePath, 'utf-8');
|
const source = readFileSync(filePath, 'utf-8');
|
||||||
return compileCss(source);
|
return await compileCss(source);
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Compile style failed: ' + filePath);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function compileStyle(filePath: string) {
|
export async function compileStyle(filePath: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user