万本电子书0元读

万本电子书0元读

顶部广告

Vue CLI 3 Quick Start Guide电子书

售       价:¥

31人正在读 | 0人评论 6.2

作       者:Ajdin Imsirovic

出  版  社:Packt Publishing

出版时间:2019-05-02

字       数:19.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Build Vue apps the right way using Vue CLI 3. Understand how the building blocks of Vue CLI 3 work including npm, webpack, babel, eslint, plugins, GUI, testing, and SCSS. Import third-party libraries and maintain your project. Key Features * Learn to work with Vue CLI 3 both on the command line and with a GUI * Manage VueJS apps, settings, Vue plugins, and third-party libraries * Learn how to build Vue apps from scratch using webpack, babel, ES6, vue-router, Jest, Cypress, SCSS, and Git Book Description The sprawling landscape of various tools in JavaScript web development is becoming overwhelming. This book will show you how Vue CLI 3 can help you take back control of the tool chain. To that end, we'll begin by configuring webpack, utilizing HMR, and using single-file .vue components. We'll also use SCSS, ECMAScript, and TypeScript. We'll unit test with Jest and perform E2E testing with Cypress. This book will show you how to configure Vue CLI as your default way of building Vue projects. You'll discover the reasons behind using webpack, babel, eslint, and other modern JavaScript toolchain technologies. You'll learn about the inner workings of each through the lens of Vue CLI 3. We'll explore the extendibility of Vue CLI with the built-in settings, and various core and third-party plugins. Vue CLI helps you work with Vue components, routers, directives, and services in the Vue ecosystem. While learning these concepts, you'll examine the evolution of JavaScript. You'll learn about use of npm, IIFEs, modules in JavaScript, Common.js modules, task runners, npm scripts, module bundlers, and webpack. You'll get familiar with the reasons why Vue CLI 3 is set up the way it is. You'll also learn to perform linting with ESLint and Prettier. Towards the end, we'll introduce you to working with styles and SCSS. Finally, we'll show you how to deploy your very own Vue project on Github Pages. What you will learn * Work with nvm, install Node.js and npm, use Vue CLI 3 with no configuration, via the command line and the graphical user interface * Build a Vue project from scratch using npm and webpack, and learn about hot module replacement * Work with Babel settings, configurations, and presets * Work with Vue plugins, including testing plugins such as Jest and Cypress * Write, run, and watch unit and E2E tests using TDD assertions in the red-green-refactor cycle * Work with Vue router and use, nested, lazy-loading, and dynamic routes * Add SCSS to your projects and work with third-party Vue plugins * Deploy your Vue apps to Github Pages Who this book is for This book is for existing web developers and developers who are new to web development. You must be familiar with HTML, CSS, and JavaScript programming. Basic knowledge of the command line will be helpful but is not necessary.
目录展开

Dedication

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Introducing Vue CLI 3

Technical requirements

Setting up Vue CLI 3 on our system

Is Vue CLI 3 already available?

Installing Node.js using Node Version Manager

Why install NVM?

Installing NVM on Windows

Installing Vue CLI 3

Installing VS Code

Using Vue CLI with no configuration

The benefits of using Vue CLI 3

Default toolchain, fatigue level zero

Vue CLI 3 default app via the command line

Vue CLI 3 default app via the UI

Summary

Webpack in Vue CLI 3

The evolution of the JS language

The script tag

Immediately Invoked Function Expressions

The problem with IIFEs

Sharing third-party libraries in a team environment with NPM

JavaScript task runners and NPM scripts

Modules in JavaScript

Working with modules in Node.js

Module bundlers, a way to use modules in the browser

What is webpack?

How webpack works

Building a new project and running webpack on it

Running webpack on a project

Adding a Vue project via NPM and using webpack with it

Adding our Vue component as a JavaScript module

Compiling JavaScript modules with webpack

Adding options with the help of the webpack configuration file

Adding an HTML file so that we can render our Vue component

Giving webpack the ability to output an HTML file

Adding a .vue file as a JavaScript module

Adding a webpack loader to work with .vue files

Fixing the issue with our index.html file

Delivering HTML files via webpack with the help of html-webpack-plugin

Understanding Hot Module Replacement in Vue

Observing HMR updates

Summary

Babel in Vue CLI 3

Understanding Babel

The building blocks of @vue/cli-plugin-babel

Babel 7 in @vue/cli-plugin-babel

The role of babel-loader in @vue/cli-plugin-babel

The role of @vue/babel-preset-app

Other features of @vue/cli-plugin-babel

Using Babel and webpack in Vue 2 without Vue CLI

Installing the necessary NPM packages

Running webpack with ES5 code

Adding webpack-dev-server

Updating the methods option to ES6 syntax

Adding babel-loader to our webpack configuration

Updating our webpack configuration to work with babel

The problem with the this keyword in arrow functions in Vue

Recommended solutions to keyword problems

Adding one counter app

Summary

Testing in Vue CLI 3

Understanding Vue plugins

Beginning testing on a brand new Vue app

Adding a new project with Vue CLI UI

Adding the Jest plugin to our Vue app

Examining the updates

Adding the code for our Vue application

Writing our first unit test inside a Vue app with Jest

Running our first unit test inside the Vue CLI UI

Importing mount from test-utils and writing another unit test

Mounting the component to be tested

Writing a failing assertion

Writing a passing assertion

Triggering a button click in our test

Test-driven development in Vue CLI 3

Improving our tests in Vue CLI 3

Watching our tests in Vue CLI 3

Writing end-to-end tests with Cypress

Introducing Cypress

Adding a Cypress plugin to our project

Verifying updates to package.json made by the Cypress plugin installation

Updating Cypress tests in our Vue app

Summary

Vue CLI 3 and Routing

Adding a new Vue project with vue-router and vuex

Configuring preset options through VS Code's command line

Adding vue-router and vuex

Adding ESLint and Prettier

Finishing the configuration

Installing all the plugins for our new project

Serving our project from the Vue CLI UI

Running the serve task from the UI

Working with routes in vue-router

Inspecting the two default routes

Inspecting project files

The contents of main.js

The App.vue file and router-link navigation

Rendering a Vue instance and mounting it into #app

Running the build task from the UI

Serving the app in production mode from the UI

Some basics of working with routes

The router-view tag needs to be nested

Using named routes

Navigating to a route by triggering a method of a Vue instance

Working with nested routes

Lazy- loading routes

Working with dynamic routes

Summary

Using ESLint and Prettier in Vue CLI 3

What ESLint is, and how to configure it on its own

Installing npm packages globally versus installing npm packages locally

What is Prettier?

Running locally-installed npm modules on the command line using npx

Installing Prettier globally and running it on index.html

Running Prettier with npx

Working with ESLint

Installing ESLint globally and unsuccessfully running it from the command line

Running eslint --init command

Understanding the structure of .eslintrc.js config file

Running ESLint on a JavaScript file

Updating error level rules in ESLint

Configuring ESLint in Vue CLI 3

Setting up ESLint configurations in Vue CLI 3 GUI

Using ESLint and Prettier together in a Vue CLI 3 UI project

Summary

Improving CSS with SCSS

Installing Bootstrap + Vue

Adding BootstrapVue as a plugin

Using the bootstrap-vue plugin to add styles to our project

Using SCSS in our project

Dealing with errors

Writing some SCSS in our project

Overriding bootstrap-vue styles

Using variables, mixins, and interpolation

Using Sassmeister to practice SCSS

Using SCSS mixins and interpolation in our Vue project

Summary

Deploying Vue CLI 3 Apps on GitHub Pages

Installing GitHub Desktop app

Understanding how Git works

Starting a new Vue app and tracking changes with Git

Committing changes to our app

The three trees concept

Branching in Git

Merging branches

Registering a new GitHub account

Adding origin/master using GitHub Desktop

Publishing your local repository

Publishing our project on GitHub Pages

Getting our project ready to be published

Updating the Vue configuration file

Saving changes and pushing them to the remote repository with GitHub Desktop

Debugging your GitHub pages deployment

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部