1.3.4 • Published 1 year ago

vite-string-plugin v1.3.4

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
1 year ago

vite-string-plugin

npm.io npm.io npm.io

Vite plugin to import files as string, with zero dependencies

Usage

vite.config.js

import {defineConfig} from "vite";
import {stringPlugin} from "vite-string-plugin";

export default defineConfig({
  plugins: [
    stringPlugin(),
  ],
});

file.js

import foo from "./foo.svg";

Options

  • match: Regex to match the path against. Default: /\.(svg|md|xml)$/i.

Typescript

Add these to your project-specific type declarations:

declare module "*.svg" {
  const value: string;
  export default value;
}
declare module "*.md" {
  const value: string;
  export default value;
}
declare module "*.xml" {
  const value: string;
  export default value;
}
1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago