Help us understand the problem. What is going on with this article?

既存のnuxtプロジェクトにvuetifyをインストール

More than 1 year has passed since last update.

概要

  • 【目的】nuxtプロジェクトにvuetifyを適用したい
  • - 環境
    • Windows10, VSCode
    • Node v8.11.3
    • Nuxt v1.4
    • vuetify v1.2.4
  • 参考

npm install

npm install --save vuetify
npm install --save-dev stylus
npm install --save-dev stylus-loader

nuxt.config.js の変更

追記する

nuxt.config.js
const nodeExternals = require('webpack-node-externals') //add
・・・・
// アイコン
  head: {
    link: [
      { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' } //add
・・・・
//CSS
css: [
    'vuetify/src/stylus/main.styl', //add
  ],
・・・・
//plugins
 plugins: [
    '@/plugins/vuetify', //add
・・・・
//webpack設定
  build: {
    extend(config, ctx) {
      if (ctx.isServer) {//add for vuetify
        config.externals = [
          nodeExternals({
            whitelist: [/^vuetify/]
          })
        ]
      }

plugin ディレクトリにvuetify.jsを新規作成

plugins/vuetify.js
import Vue from 'vue'
import Vuetify from 'vuetify'
import colors from 'vuetify/es5/util/colors'

Vue.use(Vuetify, {
  theme: {
    primary: '#121212', // a color that is not in the material colors palette
    accent: colors.grey.darken3,
    secondary: colors.amber.darken3,
    info: colors.teal.lighten1,
    warning: colors.amber.base,
    error: colors.deepOrange.accent4,
    success: colors.green.accent3
  }
})

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away