Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding cdn stylesheets and javascripts in nuxt.js

Tags:

vue.js

nuxt.js

Hi I cannot add fontawesome to my nuxt app I have try adding it in the nuxt.config.js and it still does not seem to work.

head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/leap-icon.ico' },
      { rel: 'stylesheet', ref: 'https://use.fontawesome.com/releases/v5.2.0/css/all.css' }
    ]
  },
like image 639
Dranier Avatar asked Aug 15 '18 02:08

Dranier


2 Answers

Below is the correct method to implement external resource in nuxt.

link: [{ rel:"stylesheet", type:"text/css", href:'http://www.example.com/assets/lib/bootstrap/css/bootstrap.min.css' }]
like image 199
power-cut Avatar answered Nov 10 '22 02:11

power-cut


I think just changing type to href should fix it. e.g.

  { rel: 'stylesheet', href: 'https://use.fontawesome.com/releases/v5.2.0/css/all.css' }
like image 34
theleebriggs Avatar answered Nov 10 '22 02:11

theleebriggs