Rollup plugin for bookmarklet.
It adds javascript:
prefix to code.
- Node.js v18 or later
- Rollup v2/v3/v4
npm:
npm i -D rollup-plugin-bookmarklet
Yarn:
yarn add -D rollup-plugin-bookmarklet
pnpm:
pnpm add -D rollup-plugin-bookmarklet
Use rollup-plugin-bookmarklet
in Rollup config.
JavaScript:
import terser from '@rollup/plugin-terser'
import bookmarklet from 'rollup-plugin-bookmarklet'
export default {
input: 'src/main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
terser(),
bookmarklet()
]
}
TypeScript:
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import type { RollupOptions } from 'rollup'
import bookmarklet from 'rollup-plugin-bookmarklet'
const config: RollupOptions = {
input: 'src/main.ts',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
typescript(),
terser(),
bookmarklet()
]
}
export default config