Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Vue.js: Understanding its Tools and Ecosystem

You're reading from   Vue.js: Understanding its Tools and Ecosystem Take a crash course in the main concepts and syntax of the Vue.js library

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher
ISBN-13 9781800206625
Length 194 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Dave Berning Dave Berning
Author Profile Icon Dave Berning
Dave Berning
Backstop Media LLC Backstop Media LLC
Author Profile Icon Backstop Media LLC
Backstop Media LLC
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface
1. Getting Started with Vue.js FREE CHAPTER 2. Scaffolding Projects With Vue CLI 3 3. Navigation with Vue Router 4. State Management with Vuex 5. Debugging With Vue DevTools 6. Server-Side Rendering with Nuxt.js 7. Static Site Generation with VuePress 8. Mobile App Development with NativeScript for Vue.js 9. Greater Control of JavaScript and Type Casting with TypeScript 10. The Future of Vue.js and Adoption Rates

Adding Plugins

In Nuxt, you can define third-party scripts or your own scripts and functionality that you want to be executed globally throughout your application. Since you do not have access to the main.js file in Nuxt like you would in a traditional Vue.js application, you can instead add plugins. These plugins will be initialized before the page is fully rendered and sent to the client. You create a plugin by simply adding a JavaScript file into the plugins directory. For example, let’s say you want to use Font Awesome, the popular icon font library. We certainly do not want to add the Font Awesome library within each component that needs it. That’s not very efficient or DRY. So let’s fix that with plugins.

Let’s start by creating a new file in the plugins directory called, font-awesome.js. Inside of that page, we need to import a few NPM libraries via ES6’s module syntax. Since plugins do not have access to the main Vue.js library, you need to...

lock icon The rest of the chapter is locked
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
Banner background image