DEV Community

Grant Smith
Grant Smith

Posted on

5 2

Using external scripts with NuxtJS

I'm very new to Nuxt and I can't work out how to import other Javascript libraries.

For example, I am using Bulma in my project and find the BulmaJS library very useful as it saves me a lot of time. I appear not to be importing BulmaJs correctly into my project, but cannot figure out what I am missing?

After research, I have reached the following conclusions which may or may not be correct.

After installing npm install --save-dev @vizuaalog/bulmajs I have added the following code.

/plugins/navbar.js

import Navbar from '@vizuaalog/bulmajs/src/plugins/Navbar';
export default Navbar;

/nuxtconfig.js

plugins: [
 '@/plugins/navbar.js'
],

This results in a SyntaxError Unexpected identifier error?

I have found most other aspects of Nuxt very logical, but seem to be missing the point when it comes to using Javascript within projects. Another example was using Browser Update, I added this as a static file and used in my footer component, again a bunch of warnings.

What am I not understanding?

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more