mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(cli): add convention static directory (#8929)
* fix: #8890 sfc compile error * chore(vant-cli): add convention static directory * chore(vant-cli): another way to deal with static resources
This commit is contained in:
parent
14d0a3136a
commit
384ee56f13
@ -19,6 +19,7 @@ import { genVeturConfig } from '../compiler/gen-vetur-config';
|
|||||||
import {
|
import {
|
||||||
isDir,
|
isDir,
|
||||||
isSfc,
|
isSfc,
|
||||||
|
isAsset,
|
||||||
isStyle,
|
isStyle,
|
||||||
isScript,
|
isScript,
|
||||||
isDemoDir,
|
isDemoDir,
|
||||||
@ -41,6 +42,10 @@ async function compileFile(filePath: string) {
|
|||||||
return compileStyle(filePath);
|
return compileStyle(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isAsset(filePath)) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
return remove(filePath);
|
return remove(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ export const EXT_REGEXP = /\.\w+$/;
|
|||||||
export const SFC_REGEXP = /\.(vue)$/;
|
export const SFC_REGEXP = /\.(vue)$/;
|
||||||
export const DEMO_REGEXP = new RegExp('\\' + sep + 'demo$');
|
export const DEMO_REGEXP = new RegExp('\\' + sep + 'demo$');
|
||||||
export const TEST_REGEXP = new RegExp('\\' + sep + 'test$');
|
export const TEST_REGEXP = new RegExp('\\' + sep + 'test$');
|
||||||
|
export const ASSET_REGEXP = /\.(png|jpe?g|gif|webp|ico|jfif|svg|woff2?|ttf)$/i;
|
||||||
export const STYLE_REGEXP = /\.(css|less|scss)$/;
|
export const STYLE_REGEXP = /\.(css|less|scss)$/;
|
||||||
export const SCRIPT_REGEXP = /\.(js|ts|jsx|tsx)$/;
|
export const SCRIPT_REGEXP = /\.(js|ts|jsx|tsx)$/;
|
||||||
export const ENTRY_EXTS = ['js', 'ts', 'tsx', 'jsx', 'vue'];
|
export const ENTRY_EXTS = ['js', 'ts', 'tsx', 'jsx', 'vue'];
|
||||||
@ -60,6 +61,10 @@ export function isTestDir(dir: string) {
|
|||||||
return TEST_REGEXP.test(dir);
|
return TEST_REGEXP.test(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isAsset(path: string) {
|
||||||
|
return ASSET_REGEXP.test(path);
|
||||||
|
}
|
||||||
|
|
||||||
export function isSfc(path: string) {
|
export function isSfc(path: string) {
|
||||||
return SFC_REGEXP.test(path);
|
return SFC_REGEXP.test(path);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user