mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +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>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="<%= cssLang %>">
|
||||||
.demo-button {
|
.demo-button {
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
color: #fff;
|
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 = {
|
module.exports = {
|
||||||
name: '<%= name %>',
|
name: '<%= name %>',
|
||||||
build: {
|
build: {
|
||||||
|
css: {
|
||||||
|
preprocessor: '<%= preprocessor %>',
|
||||||
|
},
|
||||||
site: {
|
site: {
|
||||||
publicPath: '/<%= name %>/'
|
publicPath: '/<%= name %>/'
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ const PROMPTS = [
|
|||||||
export class VanGenerator extends Generator {
|
export class VanGenerator extends Generator {
|
||||||
inputs = {
|
inputs = {
|
||||||
name: '',
|
name: '',
|
||||||
|
cssLang: '',
|
||||||
preprocessor: ''
|
preprocessor: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -32,8 +33,12 @@ export class VanGenerator extends Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async prompting() {
|
async prompting() {
|
||||||
return this.prompt(PROMPTS).then(inputs => {
|
return this.prompt<Record<string, string>>(PROMPTS).then(inputs => {
|
||||||
this.inputs.preprocessor = inputs.preprocessor as string;
|
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));
|
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(
|
this.fs.copyTpl(
|
||||||
join(TEMPLATES, name),
|
join(TEMPLATES, from),
|
||||||
this.destinationPath(target || name),
|
this.destinationPath(to || from),
|
||||||
this.inputs
|
this.inputs
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
copyTpl('package.json.tpl', 'package.json');
|
copyTpl('package.json.tpl', 'package.json');
|
||||||
copyTpl('vant.config.js');
|
copyTpl('vant.config.js');
|
||||||
|
copyTpl('src/**/*', 'src');
|
||||||
|
copyTpl('docs/**/*', 'docs');
|
||||||
copy('babel.config.js');
|
copy('babel.config.js');
|
||||||
copy('gitignore.tpl', '.gitignore');
|
copy('gitignore.tpl', '.gitignore');
|
||||||
copy('eslintignore.tpl', '.eslintignore');
|
copy('eslintignore.tpl', '.eslintignore');
|
||||||
copy('src/**/*', 'src');
|
|
||||||
copy('docs/**/*', 'docs');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user