mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
fix(create-app): should set css preprocessor
This commit is contained in:
parent
fa9a64b480
commit
3baca25725
@ -1,3 +0,0 @@
|
||||
.test {
|
||||
color: red;
|
||||
}
|
@ -18,7 +18,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
<style lang="<%= cssLang %>">
|
||||
.demo-button {
|
||||
min-width: 120px;
|
||||
color: #fff;
|
||||
|
@ -1,5 +0,0 @@
|
||||
@import "./var.less";
|
||||
|
||||
body {
|
||||
color: @text-color;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
@primary-color: #f44;
|
||||
@text-color: #4a4a4a;
|
@ -1,6 +1,9 @@
|
||||
module.exports = {
|
||||
name: '<%= name %>',
|
||||
build: {
|
||||
css: {
|
||||
preprocessor: '<%= preprocessor %>',
|
||||
},
|
||||
site: {
|
||||
publicPath: '/<%= name %>/'
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ const PROMPTS = [
|
||||
export class VanGenerator extends Generator {
|
||||
inputs = {
|
||||
name: '',
|
||||
cssLang: '',
|
||||
preprocessor: ''
|
||||
};
|
||||
|
||||
@ -32,8 +33,12 @@ export class VanGenerator extends Generator {
|
||||
}
|
||||
|
||||
async prompting() {
|
||||
return this.prompt(PROMPTS).then(inputs => {
|
||||
this.inputs.preprocessor = inputs.preprocessor as string;
|
||||
return this.prompt<Record<string, string>>(PROMPTS).then(inputs => {
|
||||
const preprocessor = inputs.preprocessor.toLowerCase();
|
||||
const cssLang = preprocessor === 'sass' ? 'scss' : preprocessor;
|
||||
|
||||
this.inputs.cssLang = cssLang;
|
||||
this.inputs.preprocessor = preprocessor;
|
||||
});
|
||||
}
|
||||
|
||||
@ -44,21 +49,21 @@ export class VanGenerator extends Generator {
|
||||
this.fs.copy(join(TEMPLATES, from), this.destinationPath(to || from));
|
||||
};
|
||||
|
||||
const copyTpl = (name: string, target?: string) => {
|
||||
const copyTpl = (from: string, to?: string) => {
|
||||
this.fs.copyTpl(
|
||||
join(TEMPLATES, name),
|
||||
this.destinationPath(target || name),
|
||||
join(TEMPLATES, from),
|
||||
this.destinationPath(to || from),
|
||||
this.inputs
|
||||
);
|
||||
};
|
||||
|
||||
copyTpl('package.json.tpl', 'package.json');
|
||||
copyTpl('vant.config.js');
|
||||
copyTpl('src/**/*', 'src');
|
||||
copyTpl('docs/**/*', 'docs');
|
||||
copy('babel.config.js');
|
||||
copy('gitignore.tpl', '.gitignore');
|
||||
copy('eslintignore.tpl', '.eslintignore');
|
||||
copy('src/**/*', 'src');
|
||||
copy('docs/**/*', 'docs');
|
||||
}
|
||||
|
||||
install() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user