0.0.17 • Published 2 months ago

@macropygia/vite-plugin-glob-input v0.0.17

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@macropygia/vite-plugin-glob-input

npm version MIT TypeScript Vite

English | 日本語

Vite plugin to add files to build.rollupOptions.input using fast-glob.

  • This package is currently unstable.
    • Breaking changes may occur without any notice, even if in patch releases.
    • See CHANGELOG for changes.
  • This package only works as ESM.
    • "type": "module" is required in the package.json of the project using this plugin.
  • Suitable for a traditional static site.
  • Auto-generate alias from directory and file name.
    • /index.html -> home
    • /foo.html -> root_foo
    • /foo/index.html -> foo
    • /foo/bar.html -> foo_bar
  • Merge build.rollupOptions.input if it already exists.
    • Except string
    • No duplicate check

Usage

// vite.config.js
import { defineConfig } from 'vite'
import vitePluginGlobInput from '@macropygia/vite-plugin-glob-input'

export default defineConfig({
  plugins: [
    vitePluginGlobInput({
      patterns: 'src/**/*.html',
    }),
  ],
})

Options

ParameterTypeDefaultRequired
patternsstring \| string[]Yes
optionsobjectNo
disableAliasbooleanfalseNo
homeAliasstringhomeNo
rootPrefixstringrootNo
dirDelimiterstring-No
filePrefixstring_No

patterns

options

disableAlias

  • Disable alias auto-generation.
  • Change type of build.rollupOptions.input to string[].

homeAlias

Alias for index in root directory.

/index.html -> home

rootPrefix

Alias for root directory. It will use when the root directory has non-index files.

/foo.html -> root_foo

dirDelimiter

Delimiter for joining directory names.

/foo/bar/index.html -> foo-bar

filePrefix

Prefix for non-index files.

/foo/bar/baz.html -> foo-bar_baz

0.0.17

2 months ago

0.0.16

1 year ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago