0.0.0-alpha.0 β€’ Published 2 years ago

unplugin-bootstrap-vue-plus v0.0.0-alpha.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

unplugin-bootstrap-vue-plus

Unit Test

English | δΈ­ζ–‡

This repo is for Bootstrap Vue Plus related unplugin. Thanks @antfu.

Features
  • πŸ’š On-demand import style for Bootstrap Vue Plus.
  • 🌎 Replace default locale.
  • ⚑️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.

Installation

npm i unplugin-bootstrap-vue-plus -D
// vite.config.ts
import BootstrapVuePlus from 'unplugin-bootstrap-vue-plus/vite'

export default {
  plugins: [
    BootstrapVuePlus({
      // options
    }),
  ],
}

// rollup.config.js
import BootstrapVuePlus from 'unplugin-bootstrap-vue-plus/rollup'

export default {
  plugins: [
    BootstrapVuePlus({
      // options
    }),
  ],
}

// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [
    require('unplugin-bootstrap-vue-plus/esbuild')({
      // options
    }),
  ],
})

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-bootstrap-vue-plus/webpack')({
      // options
    }),
  ],
}

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-bootstrap-vue-plus/webpack')({
        // options
      }),
    ],
  },
}

Usage

It will automatically transform:

import { BvButton } from 'bootstrap-vue-plus'

//    ↓ ↓ ↓ ↓ ↓ ↓

import { BvButton } from 'bootstrap-vue-plus'
import 'bootstrap-vue-plus/es/components/button/style/css'

Options

useSource

type UseSource = boolean

default: false

// useSource: false
import { BvButton } from 'bootstrap-vue-plus'

//    ↓ ↓ ↓ ↓ ↓ ↓

import { BvButton } from 'bootstrap-vue-plus'
import 'bootstrap-vue-plus/es/components/button/style/css'

// useSource: true
import { BvButton } from 'bootstrap-vue-plus'

//    ↓ ↓ ↓ ↓ ↓ ↓

import { BvButton } from 'bootstrap-vue-plus'
import 'bootstrap-vue-plus/es/components/button/style/index'

lib

Normally you wouldn't use this option but as a general option we exposed it anyway. When using this your bundle structure should be the same as BootstrapVuePlus. See unpkg.com for more information.

type Lib = string

default: 'bootstrap-vue-plus'

// lib: 'other-lib'
import { BvButton } from 'other-lib'

//    ↓ ↓ ↓ ↓ ↓ ↓

import { BvButton } from 'other-lib'
import 'other-lib/es/components/button/style/css'

format

type Format = 'esm' | 'cjs'

default: 'esm'

esm for bootstrap-vue-plus/es/components/*

cjs for bootstrap-vue-plus/lib/components/*

  • /es for ES Module
  • /lib for CommonJS

This option is for which format to use

// format: 'cjs'
import { BvButton } from 'bootstrap-vue-plus'

//    ↓ ↓ ↓ ↓ ↓ ↓

import { BvButton } from 'bootstrap-vue-plus'
import 'bootstrap-vue-plus/lib/components/button/style/css'

prefix

type Prefix = string
// prefix = Al
import { AlButton } from 'xx-lib'

defaultLocale

Replace default locale, you can find locale list here.

Alternate