All Projects → vuetifyjs → Vuetify Loader

vuetifyjs / Vuetify Loader

Licence: mit
📦 A Webpack plugin for treeshaking Vuetify components and more

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vuetify Loader

webpack-ext-reloader
Add hot reloading to your webpack WebExtension! 🔥
Stars: ✭ 31 (-91.29%)
Mutual labels:  webpack-plugin
shared-library-webpack-plugin
Webpack plugin for library sharing at runtime between applications
Stars: ✭ 35 (-90.17%)
Mutual labels:  webpack-plugin
Filemanager Webpack Plugin
Copy, move, archive (zip/tar/tar.gz), delete files and directories before and after Webpack builds. Win32/Mac/*Nix supported
Stars: ✭ 310 (-12.92%)
Mutual labels:  webpack-plugin
copy-modules-webpack-plugin
A Webpack plugin which copies module sources to a separate directory
Stars: ✭ 17 (-95.22%)
Mutual labels:  webpack-plugin
ignore-emit-webpack-plugin
Prevents ignored files from being emitted during a Webpack build
Stars: ✭ 17 (-95.22%)
Mutual labels:  webpack-plugin
Webpack Virtual Modules
Webpack Virtual Modules is a webpack plugin that lets you create, modify, and delete in-memory files in a way that webpack treats them as if they were physically presented in the file system.
Stars: ✭ 286 (-19.66%)
Mutual labels:  webpack-plugin
prettier-webpack-plugin
Process your Webpack dependencies with Prettier
Stars: ✭ 47 (-86.8%)
Mutual labels:  webpack-plugin
Awesome Cms Core
Awesome CMS Core is an open source CMS built using ASP.Net Core & ReactJS with module seperation concern in mind and provide lastest trend of technology like .Net Core, React, Webpack, SASS, Background Job, Message Queue.
Stars: ✭ 352 (-1.12%)
Mutual labels:  webpack-plugin
stylos
Webpack plugin to automatically generate and inject CSS utilities to your application
Stars: ✭ 60 (-83.15%)
Mutual labels:  webpack-plugin
Webpack Cdn Plugin
A webpack plugin that use externals of CDN urls for production and local node_modules for development
Stars: ✭ 306 (-14.04%)
Mutual labels:  webpack-plugin
chunk-splitting-plugin
Arbitrarily split your Webpack chunks and bundles into smaller pieces
Stars: ✭ 15 (-95.79%)
Mutual labels:  webpack-plugin
swig-webpack-plugin
Render swig templates with webpack.
Stars: ✭ 12 (-96.63%)
Mutual labels:  webpack-plugin
Purgecss Webpack Plugin
Purgecss plugin for webpack
Stars: ✭ 299 (-16.01%)
Mutual labels:  webpack-plugin
add-module-exports-webpack-plugin
Add `module.exports` for Babel and TypeScript compiled code
Stars: ✭ 36 (-89.89%)
Mutual labels:  webpack-plugin
Web Webpack Plugin
alternative for html-webpack-plugin
Stars: ✭ 318 (-10.67%)
Mutual labels:  webpack-plugin
bundle-inspector-webpack-plugin
Bundle Inspector | Analysis Tool for Webpack
Stars: ✭ 19 (-94.66%)
Mutual labels:  webpack-plugin
Webpack Assets Manifest
This Webpack plugin will generate a JSON file that matches the original filename with the hashed version.
Stars: ✭ 269 (-24.44%)
Mutual labels:  webpack-plugin
Webpack Extension Reloader
A upgrade from 🔥webpack-chrome-extension-reloader🔥, now on all browsers
Stars: ✭ 355 (-0.28%)
Mutual labels:  webpack-plugin
I18n Webpack Plugin
[DEPRECATED] Embed localization into your bundle
Stars: ✭ 320 (-10.11%)
Mutual labels:  webpack-plugin
Webpack Sentry Plugin
Webpack plugin to upload source maps to Sentry
Stars: ✭ 299 (-16.01%)
Mutual labels:  webpack-plugin

vuetify-loader

Become a Patron

Automatic Imports

vuetify-loader will automatically import all Vuetify components as you use them

// webpack.config.js

const { VuetifyLoaderPlugin } = require('vuetify-loader')

exports.plugins.push(
  new VuetifyLoaderPlugin()
)

You can also provide a custom match function to import your own project's components too:

// webpack.config.js

const { VuetifyLoaderPlugin } = require('vuetify-loader')

exports.plugins.push(
  new VuetifyLoaderPlugin({
    /**
     * This function will be called for every tag used in each vue component
     * It should return an array, the first element will be inserted into the
     * components array, the second should be a corresponding import
     *
     * originalTag - the tag as it was originally used in the template
     * kebabTag    - the tag normalised to kebab-case
     * camelTag    - the tag normalised to PascalCase
     * path        - a relative path to the current .vue file
     * component   - a parsed representation of the current component
     */
    match (originalTag, { kebabTag, camelTag, path, component }) {
      if (kebabTag.startsWith('core-')) {
        return [camelTag, `import ${camelTag} from '@/components/core/${camelTag.substring(4)}.vue'`]
      }
    }
  })
)

or if you're using Vue CLI:

// vue.config.js

module.exports = {
  chainWebpack: config => {
    config.plugin('VuetifyLoaderPlugin').tap(args => [{
      match (originalTag, { kebabTag, camelTag, path, component }) {
        if (kebabTag.startsWith('core-')) {
          return [camelTag, `import ${camelTag} from '@/components/core/${camelTag.substring(4)}.vue'`]
        }
      }
    }])
  }
}
<template>
  <core-form>
    <v-card>
      ...
    </v-card>
  </core-form>
</template>

<script>
  export default {
    ...
  }
</script>

Will be compiled into:

<template>
  <core-form>
    <v-card>
      ...
    </v-card>
  </core-form>
</template>

<script>
  import { VCard } from 'vuetify/lib'
  import CoreForm from '@/components/core/Form.vue'

  export default {
    components: {
      VCard,
      CoreForm
    },
    ...
  }
</script>

Progressive images

vuetify-loader can automatically generate low-res placeholders for the v-img component

NOTE: You must have ImageMagick, GraphicsMagick, or sharp installed for this to work

Add progressiveImages to the plugin options:

exports.plugins.push(
  new VuetifyLoaderPlugin({
    progressiveImages: true
  })
)

// vue-cli
module.exports = {
  chainWebpack: config => {
    config.plugin('VuetifyLoaderPlugin').tap(args => [{
      progressiveImages: true
    }])
  }
}

And away you go!

<v-img src="@/assets/some-image.jpg"></v-img>

NOTE: The src must follow vue-loader's transform rules

Loops and dynamic paths

progressiveImages only works on static paths, for use in a loop you have to require the image yourself:

<v-img v-for="i in 10" :src="require(`@/images/image-${i}.jpg?vuetify-preload`)" :key="i">

Configuration

progressiveImages: true can be replaced with an object for advanced configuration

new VuetifyLoaderPlugin({
  progressiveImages: {
    size: 12, // Use higher-resolution previews
    sharp: true // Use sharp instead of ImageMagick
  }
})

Options

size

Type: Number Default: 9

The minimum dimensions of the generated preview images in pixels

resourceQuery

Type: RegExp Default: /vuetify-preload/

Override the resource qury to match v-img URLs

If you only want some images to have placeholders, add ?lazy to the end of the request:

<v-img src="@/assets/some-image.jpg?lazy"></v-img>

And modify the regex to match:

new VuetifyLoaderPlugin({
  progressiveImages: {
    resourceQuery: /lazy\?vuetify-preload/
  }
})
sharp

Type: Boolean Default: false

Use sharp instead of GM for environments without ImageMagick. This will result in lower-quality images

graphicsMagick

Type: Boolean Default: false

Use GraphicsMagic instead of ImageMagick

registerStylesSSR

Type: Boolean Default: false

Register Vuetify styles in vue-style-loader.

This fixes styles not being loaded when doing SSR (for example when using @nuxtjs/vuetify). As Vuetify imports styles with JS, without this option, they do not get picked up by SSR.

⚠️ This option requires having manualInject set to true in vue-style-loader config.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].