LinuxCommandLibrary

vue-init

Initialize new Vue.js projects

TLDR

Create a new project using one of the default templates

$ vue init [webpack|webpack-simple|browserify|browserify-simple|simple] [project_name]
copy

Create a new project using a local template
$ vue init [path/to/template_directory] [project_name]
copy

Create a new project using a template from GitHub
$ vue init [username]/[repo] [project_name]
copy

SYNOPSIS

vue init <template> <project-name> [options]

PARAMETERS

template
    Specifies the template to use for scaffolding. This can be an official template name (e.g., webpack), or a GitHub repository path (e.g., owner/repo).

project-name
    The name of the new project directory to be created. The project files will be initialized inside this directory.

-c, --clone
    Forces the use of git clone for template download instead of the default API download. Useful for private repositories or specific Git features.

-o, --offline
    Uses a locally cached version of the template if available, avoiding network requests.

-h, --help
    Displays help information and usage details for the command.

DESCRIPTION

The vue-init command was a core utility of Vue CLI 2.x, designed to quickly scaffold new Vue.js projects. It allowed developers to initialize a project structure based on predefined templates, such as the official webpack or webpack-simple templates, or even custom templates hosted on GitHub. Upon execution, it would download the chosen template and then prompt the user for configuration details like project name, description, and feature choices (e.g., linting, Vue Router). This streamlined the project setup process, providing a consistent starting point for various types of Vue applications.

CAVEATS

The vue-init command is deprecated in Vue CLI 3.x and newer versions. Users are strongly encouraged to use the more advanced and feature-rich vue create command for new projects. vue-init primarily functions when Vue CLI 2.x is installed, or as a legacy fallback. Templates might not be actively maintained and may have compatibility issues with newer Vue versions or build tools.

INTERACTIVE PROMPTS

After the template is downloaded, vue-init typically presents a series of interactive prompts. These prompts allow the user to customize various aspects of the new project, such as its name, description, author, whether to include Vue Router, ESLint, or unit testing frameworks, based on the options provided by the chosen template.

TEMPLATE LOCATIONS

Templates for vue-init are primarily sourced from GitHub. Official templates like webpack or webpack-simple are shorthand for repositories under the vuejs-templates organization (e.g., vuejs-templates/webpack). Users can also specify custom templates directly from any GitHub repository using the owner/repo syntax, or even local paths for offline template development.

HISTORY

Introduced as the primary project scaffolding tool with Vue CLI 2.x (released around 2016-2017), vue-init quickly became the standard method for initializing Vue.js applications. It facilitated rapid development by providing pre-configured project setups. However, with the release of Vue CLI 3 in 2018, which brought significant architectural changes and new capabilities like graphical user interfaces and plugin management, vue-init was superseded by vue create. While vue-init could still be used with Vue CLI 3+ if CLI 2.x was installed, its role diminished, marking a shift towards a more modular and extensible CLI experience.

SEE ALSO

vue create, vue add, npm(1), yarn(1), git(1)

Copied to clipboard