feat(cli): reload vant config
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import decamelize from 'decamelize';
|
||||
import { join } from 'path';
|
||||
import { get } from 'lodash';
|
||||
import {
|
||||
lstatSync,
|
||||
existsSync,
|
||||
@@ -8,7 +7,7 @@ import {
|
||||
readFileSync,
|
||||
outputFileSync
|
||||
} from 'fs-extra';
|
||||
import { CONFIG, SRC_DIR, WEBPACK_CONFIG_FILE } from './constant';
|
||||
import { SRC_DIR, WEBPACK_CONFIG_FILE, VANT_CONFIG_FILE } from './constant';
|
||||
|
||||
export const EXT_REGEXP = /\.\w+$/;
|
||||
export const SFC_REGEXP = /\.(vue)$/;
|
||||
@@ -81,6 +80,12 @@ export function pascalize(str: string): string {
|
||||
);
|
||||
}
|
||||
|
||||
export function getVantConfig() {
|
||||
delete require.cache[VANT_CONFIG_FILE];
|
||||
|
||||
return require(VANT_CONFIG_FILE);
|
||||
}
|
||||
|
||||
export function getWebpackConfig(): object {
|
||||
if (existsSync(WEBPACK_CONFIG_FILE)) {
|
||||
const config = require(WEBPACK_CONFIG_FILE);
|
||||
@@ -110,16 +115,6 @@ export function isDev() {
|
||||
return process.env.NODE_ENV === 'development';
|
||||
}
|
||||
|
||||
export function getCssLang(): string {
|
||||
const preprocessor = get(CONFIG, 'build.css.preprocessor', 'less');
|
||||
|
||||
if (preprocessor === 'sass') {
|
||||
return 'scss';
|
||||
}
|
||||
|
||||
return preprocessor;
|
||||
}
|
||||
|
||||
// Smarter outputFileSync
|
||||
// Skip if content unchanged
|
||||
export function smartOutputFile(filePath: string, content: string) {
|
||||
|
||||
Reference in New Issue
Block a user