sn4ke
sn4ke

Reputation: 619

webpack cli menu for setting configuration

I see in the vue-cli setup something like this (meta.js)

user@ny-laptop ~/Documents/
> $ vue init webpack my-project                                                                                          

? Project name hi
? Project description how do i get this menu?
? Author (user <[email protected]>)
...etc

How does one go about creating a menu based configuration like this for a new webpack project? I have a core template that will have a lot of options, being able to select ahead of time would be very helpful.

thanks

Upvotes: 1

Views: 84

Answers (1)

acdcjunior
acdcjunior

Reputation: 135752

You do it by adding properties to the meta.js.

Step by step example:

Example output (notice second question):

$ vue init acdcjunior/webpack-vue-template my-project-from-my-template

? Project name my-project-from-my-template
? How's the weather today? Very nice, thanks.
? Project description A Vue.js project template by acdcjunior
...

The created properties can be used in the templates:

This is valid for Vue-cli v2.x.

Upvotes: 1

Related Questions