Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Vue.js 3 By Example

You're reading from   Vue.js 3 By Example Blueprints to learn Vue web development, full-stack development, and cross-platform development quickly

Arrow left icon
Product type Paperback
Published in Apr 2021
Publisher Packt
ISBN-13 9781838826345
Length 320 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
John Au-Yeung John Au-Yeung
Author Profile Icon John Au-Yeung
John Au-Yeung
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Chapter 1: Creating Your First Application in Vue 3 2. Chapter 2: Building a Vue 3 Progressive Web App FREE CHAPTER 3. Chapter 3: Building a Slider Puzzle Game with Tests 4. Chapter 4: Building a Photo Management Desktop App 5. Chapter 5: Building a Multipurpose Calculator Mobile App with Ionic 6. Chapter 6: Building a Vacation Booking App with the PrimeVue UI Framework 7. Chapter 7: Creating a Shopping Cart System with GraphQL 8. Chapter 8: Building a Chat App with Vue 3, Laravel, and Socket.IO 9. Other Books You May Enjoy

Introducing the GitHub portfolio app

The main project of this chapter is a GitHub portfolio app. It is a PWA, which means it has all the features listed in the Basic theory on components and PWAs section of this chapter. These features are provided automatically by the @vue/cli-plugin-pwa plugin. We can add the code we need, to add the service workers and any other required configuration with one command. This way, we don't have to configure everything all by ourselves from scratch when we create our Vue project.

To get started with our app project, we will create it using Vite. We go into the folder where we want our project to be, and then run Vite to create the Vue 3 app project. To do this, we run the following commands with Node Package Manager (npm):

  1. The first command, shown in the following code snippet, runs npm to install the Vue command-line interface (CLI) globally:
    npm install -g @vue/cli@next
  2. We run the Vue CLI to create our Vue 3 project. Our project folder name is vue-example-ch2-github-app. The following command is needed to create the project folder with all the files and settings added so that we don't have to add them ourselves. This command goes to the project folder we just created and chooses the Vue 3 project when asked:
    npm vue create vue-example-ch2-github-app 
  3. Then, we run the following command to run the development server so that we can see the project in the browser and refresh the app preview when we write our code:
    npm run serve

Alternatively, we can run the following commands with Yet Another Resource Negotiator (YARN):

  1. We run yarn global add to install the Vue CLI globally, as follows:
    yarn global add @vue/cli@next
  2. To create the Vue 3 project, we run the following command and choose the Vue 3 project when asked:
    yarn create vue-example-ch2-github-app
  3. Then, we run the following command to run the development server so that we can see the project in the browser and refresh the app preview when we write our code:
    yarn serve

All the preceding commands are the same, as in they both create the project the same way; it's just a matter of which package manager we want to use to create our Vue 3 project. At this point, the project folder will have the required files for our Vue 3 project.

Our GitHub portfolio app is a progressive web app, and we can create this app easily with an existing Vue CLI plugin. Once we have created the project, we can start creating our Vue 3 PWA.

You have been reading a chapter from
Vue.js 3 By Example
Published in: Apr 2021
Publisher: Packt
ISBN-13: 9781838826345
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime