Is there any guide to configure Vuetify/Webpack to work with vuetify loader?

Viewed 1460

I'm trying to get working Vuetify with Laravel using Vuetify Loader/Webpack to minimize the files size without luck. From the original files i only change a few. In https://vuetifyjs.com/en/customization/a-la-carte/ i read that is necessary to config webpack.config.js to parse .sass files because i don't use Vue CLI (i'm using Laravel with Vuetify but begin from welcome.blade.php)

webpackpack.mix.js:

const mix = require('laravel-mix');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .webpackConfig({
       plugins: [
            new VuetifyLoaderPlugin(),
        ]
});

resources/js/plugins/vuetify.js

import Vue from 'vue'
import Vuetify from 'vuetify/lib'

Vue.use(Vuetify)

const opts = {}

export default new Vuetify(opts)

resources/js/app.js

import './bootstrap';
import Vue from 'vue';
import vuetify from './plugins/vuetify'
import App from './App.vue'

const app = new Vue({
    vuetify,
    el: '#app',
    render: (h) => h(App) 
});

App.vue (from pre-made layout Baseline)

<template>
  <v-row>
    <v-navigation-drawer
        v-model="drawer"
        app
    >
      <v-list dense>
        <v-list-item link>
          <v-list-item-action>
            <v-icon>mdi-home</v-icon>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>Home</v-list-item-title>
          </v-list-item-content>
        </v-list-item>
        <v-list-item link>
          <v-list-item-action>
            <v-icon>mdi-contact-mail</v-icon>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>Contact</v-list-item-title>
          </v-list-item-content>
        </v-list-item>
      </v-list>
    </v-navigation-drawer>
    <v-app-bar
      app
      color="indigo"
      dark
    >
      <v-app-bar-nav-icon @click.stop="drawer = !drawer" />
      <v-toolbar-title>Application</v-toolbar-title>
    </v-app-bar>
    <v-content>
      <v-container
        class="fill-height"
        fluid
      >
        <v-row
          align="center"
          justify="center"
        >
          <v-col class="text-center">
            <v-tooltip left>
              <template v-slot:activator="{ on }">
                <v-btn
                  :href="source"
                  icon
                  large
                  target="_blank"
                  v-on="on"
                >
                  <v-icon large>mdi-code-tags</v-icon>
                </v-btn>
              </template>
              <span>Source</span>
            </v-tooltip>

            <v-tooltip right>
              <template v-slot:activator="{ on }">
                <v-btn
                  icon
                  large
                  href="https://codepen.io/johnjleider/pen/zgxeLQ"
                  target="_blank"
                  v-on="on"
                >
                  <v-icon large>mdi-codepen</v-icon>
                </v-btn>
              </template>
              <span>Codepen</span>
            </v-tooltip>
          </v-col>
        </v-row>
      </v-container>
    </v-content>
    <v-footer
      color="indigo"
      app
    >
      <span class="white--text">&copy; 2019</span>
    </v-footer>
  </v-row>
</template>

<script>
  export default {
    props: {
      source: String,
    },
    data: () => ({
      drawer: null,
    }),
  }
</script>

resources/sass/app.js

// Fonts
@import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900');
@import url('https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css');

// Variables
@import 'variables';

// Vuetify
@import '~vuetify/dist/vuetify.min.css'; 

resources/views/welcome.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Laravel</title>

    <!-- Styles -->
    <link href="{{ asset(mix('css/app.css')) }}" rel="stylesheet">
  </head>
  <body>
    <div id="app"></div>
    <script src="{{ asset(mix('js/app.js')) }}"></script>
  </body>
</html>

I try without the last line also

As the problem stills, i think that maybe i forgot something or configure something wrong. Then i try begin with this example project

https://github.com/nekosaur/laravel-vuetify

changing only App.vue to use the pre-made layout Baseline from Vuetify site. The result is the same, seems that the the styles are missing...

unexpected result

The expected result is

expected result

Anybody using Vuetify with loader and Laravel??

0 Answers
Related