vite-plugin-dates

0.0.1 • Public • Published

vite-plugin-dates

A Vite alternative to Anton Medvedev's @year packages.

Built as an example for a blog post covering virtual modules.

Install

npm i vite-plugin-dates -D

Configuration

import { dirname } from 'path'
import viteDates from 'vite-plugin-dates'

export default {
  root: dirname(new URL(import.meta.url).pathname),
  plugins: [viteDates()],
}

Usage

import birthday from 'dates:1986/03/05'

document.body.innerHTML = `<p>My birthday is <b>${
  new Intl.DateTimeFormat('en', { dateStyle: 'long' }).format(birthday)
}</b>.</p>`

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i vite-plugin-dates

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

1.77 kB

Total Files

3

Last publish

Collaborators

  • galvez