mirror of
https://github.com/youzan/vant.git
synced 2025-10-17 16:44:21 +00:00
chore(@vant/cli): remove TildeResolver
This commit is contained in:
@@ -1,25 +1,13 @@
|
||||
import { render, FileManager } from 'less';
|
||||
import { join } from 'path';
|
||||
import { render } from 'less';
|
||||
import { readFileSync } from 'fs-extra';
|
||||
|
||||
// less plugin to resolve tilde
|
||||
class TildeResolver extends FileManager {
|
||||
loadFile(filename: string, ...args: any[]) {
|
||||
filename = filename.replace('~', '');
|
||||
return FileManager.prototype.loadFile.apply(this, [filename, ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
const TildeResolverPlugin = {
|
||||
install(lessInstance: unknown, pluginManager: any) {
|
||||
pluginManager.addFileManager(new TildeResolver());
|
||||
},
|
||||
};
|
||||
import { CWD } from '../common/constant';
|
||||
|
||||
export async function compileLess(filePath: string) {
|
||||
const source = readFileSync(filePath, 'utf-8');
|
||||
const { css } = await render(source, {
|
||||
filename: filePath,
|
||||
plugins: [TildeResolverPlugin],
|
||||
paths: [join(CWD, 'node_modules')],
|
||||
});
|
||||
|
||||
return css;
|
||||
|
1
packages/vant-cli/src/module.d.ts
vendored
1
packages/vant-cli/src/module.d.ts
vendored
@@ -1,5 +1,4 @@
|
||||
// some modules with missing type definitions
|
||||
declare module 'less';
|
||||
declare module 'execa';
|
||||
declare module 'hash-sum';
|
||||
declare module 'clean-css';
|
||||
|
Reference in New Issue
Block a user