You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+100-8Lines changed: 100 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,20 @@ List of 300 VueJS Interview Questions
193
193
|184|[How do you create project using Vue CLI?](#how-do-you-create-project-using-vue-cli)|
194
194
|185|[How do you create project using GUI?](#how-do-you-create-project-using-gui)|
195
195
|186|[What are plugins in vue CLI?](#what-are-plugins-in-vue-cli)|
196
+
|187|[How do you install plugins in an existing Vue CLI project?](#how-do-you-install-plugins-in-an-existing-vue-cli-project)|
197
+
|188|[How to access local plugins in a project?](#how-to-access-local-plugins-in-a-project)|
198
+
|189|[How do you create UI plugins kind of behavior?](#how-do-you-create-ui-plugins-kind-of-behavior)|
199
+
|190|[What are presets?](#what-are-presets)|
200
+
|191|[What is the versioning behavior in preset plugins?](#what-is-the-versioning-behavior-in-preset-plugins)|
201
+
|192|[How do you allow plugin prompts?](#how-do-you-allow-plugin-prompts)|
202
+
|193|[What are remote presets?](#what-are-remote-presets)|
203
+
|194|[](#)|
204
+
|195|[](#)|
205
+
|196|[](#)|
206
+
|197|[](#)|
207
+
|198|[](#)|
208
+
|199|[](#)|
209
+
|200|[](#)|
196
210
197
211
1.### What is VueJS?
198
212
**Vue.js** is an open-source, progressive Javascript framework for building user interfaces that aim to be incrementally adoptable. The core library of VueJS is focused on the `view layer` only, and is easy to pick up and integrate with other libraries or existing projects.
@@ -3286,7 +3300,7 @@ List of 300 VueJS Interview Questions
3286
3300
vue serve MyComponent.vue
3287
3301
vue build MyComponent.vue
3288
3302
```
3289
-
184. ### How do you create project using vue cli?
3303
+
184. ### How do you create project using vue CLI?
3290
3304
You can create project using `vue create` command
3291
3305
```javascript
3292
3306
vue create my-app
@@ -3302,13 +3316,91 @@ List of 300 VueJS Interview Questions
Vue CLI uses a plugin-based architecture where each plugin can modify the internal webpack configuration and inject commands to `vue-cli-service`. i.e, Each feature is implemented as a plugin. This architecture makes Vue CLI flexible and extensible.
3305
-
187. ### ?
3306
-
188. ### ?
3307
-
189. ### ?
3308
-
190. ### ?
3309
-
191. ### ?
3310
-
192. ### ?
3311
-
193. ### ?
3319
+
187. ### How do you install plugins in an existing Vue CLI project?
3320
+
You can install a plugin into an already created project with the `vue add` command.
3321
+
```javascript
3322
+
vue add @vue/eslint
3323
+
(OR)
3324
+
vue add @vue/cli-plugin-eslint
3325
+
```
3326
+
You can also add options for plugin
3327
+
```javascript
3328
+
vue add @vue/eslint --config airbnb --lintOn save
3329
+
```
3330
+
If a plugin is already installed, you can skip the installation and only invoke its generator with the `vue invoke` command.
3331
+
188. ### How to access local plugins in a project?
3332
+
If you need access to the plugin API in your project without creating a full plugin, you can use the `vuePlugins.service` option in your package.json file
3333
+
```javascript
3334
+
{
3335
+
"vuePlugins": {
3336
+
"service": ["my-service.js"]
3337
+
}
3338
+
}
3339
+
```
3340
+
189. ### How do you create UI plugins kind of behavior?
3341
+
You can also add files that will behave like UI plugins with the `vuePlugins.ui` option
3342
+
```javascript
3343
+
{
3344
+
"vuePlugins": {
3345
+
"ui": ["my-ui.js"]
3346
+
}
3347
+
}
3348
+
```
3349
+
190. ### What are presets?
3350
+
A Vue CLI preset is a JSON object that contains pre-defined options and plugins for creating a new project without interactive prompts to select them. During project creation(using vue create), the presets will be saved in a `~/.vuerc` which can modified at any time.
3351
+
For example, the generated JSON object(or preset) would be as below
3352
+
```javascript
3353
+
{
3354
+
"useConfigFiles":true,
3355
+
"router":true,
3356
+
"vuex":true,
3357
+
"cssPreprocessor":"sass",
3358
+
"plugins": {
3359
+
"@vue/cli-plugin-babel": {},
3360
+
"@vue/cli-plugin-eslint": {
3361
+
"config":"airbnb",
3362
+
"lintOn": ["save", "commit"]
3363
+
}
3364
+
}
3365
+
}
3366
+
```
3367
+
191. ### What is the versioning behavior in preset plugins?
3368
+
You can explicitly specify versions of the plugins being used.
3369
+
```javascript
3370
+
{
3371
+
"plugins": {
3372
+
"@vue/cli-plugin-eslint": {
3373
+
"version":"^3.0.0",
3374
+
// ... other options for this plugin
3375
+
}
3376
+
}
3377
+
}
3378
+
```
3379
+
For official plugins, the CLI will automatically use the latest version available in the registry
3380
+
192. ### How do you allow plugin prompts?
3381
+
Each plugin can inject its own prompts during the project creation process irrespective of preset declarations using **prompts: true** setting
3382
+
For example, user can pick their own ESLint config using the below configuration
3383
+
```javascript
3384
+
{
3385
+
"plugins": {
3386
+
"@vue/cli-plugin-eslint": {
3387
+
// let the users pick their own ESLint config
3388
+
"prompts":true
3389
+
}
3390
+
}
3391
+
}
3392
+
```
3393
+
193. ### What are remote presets?
3394
+
You can share a preset with other developers by publishing it in a git repo. The repo can be published in either github, GitLab or BitBucket.
3395
+
The repo will contain below files,
3396
+
1. **preset.json:** The main file containing the preset data and it is required.
3397
+
2. **generator.js:** A generator that can inject or modify files in the project.
3398
+
3. **prompts.js:** A prompts file that can collect options for the generator.
3399
+
You can apply `--preset` option to use remote presets while creating the project
0 commit comments