Vue cli2项目初始化

Vue CLI2详解

  • Vue CLI2初始化项目

  1. vue init webpack my-project
    • 初始化命令,据你用的文件名创建一个文件夹,存放之后项目的内容
    • 该名称也会作为默认的项目名称,但是不能包含大写字母等
  2. ? Project name (my-project)
    • 项目名称不能包含大写
    • 默认(回车)将上一个文件名作为项目名称
  3. ? Project description (A Vue.js project)
    • 作者的名称
    • 默认(回车)从git中读取信息
  4. ? Author (xiaoqiang <[email protected]>)
    • 作者的邮箱
      • 默认(回车)从git中读取信息
  5. > Runtime + Compiler: recommended for most users
    • 如果在之后的开发中,你依然使用template,就需要选择Runtime-Compiler
    • 如果你之后的开发中,使用的是.vue文件夹开发,那么可以选择Runtime-only
  6. ? Install vue-router? (Y/n)
    • 是否安装vue-router(路由)
  7. ? Use ESLint to lint your code? (Y/n)
    • ES6Lint检测代码规范
  8. ? Set up unit tests (Y/n)
    • 单元测试
      • 某些公司强制要求要学单元测试
  9. ? Setup e2e tests with Nightwatch? (Y/n)
    • e2e测试(end to end)
      • 安装Nightwatch,是一个利用selenium或webdriver或phantomjs等进行自动化检测的框架
  10. ? Should we run `npm install` for you after the project has been created? (recommended) (Use arrow keys)
    > Yes, use NPM
      Yes, use Yarn
      No, I will handle that myself
    • 选择yarn或者npm安装都可以
  • 项目目录详情结构

  • build文件夹及config文件夹
    • webpack相关配置
  • node_modules文件夹
    • 依赖node相关的模块
  • src文件夹
    • 写代码的地方
  • .babelrc文件
    • ES代码相关转化配置
  • .editorconfig文件
    • 项目文本相关配置
  • .gitignore文件
    • Git仓库忽略的文件夹配置
  • .postcssrc.js文件
    • CSS相关转换的配置

猜你喜欢

转载自www.cnblogs.com/landuo629/p/12468893.html