esbuild-plugin-bookmarklet
v1.0.0
Published
An esbuild plugin to generate bookmarklets!
Downloads
12
Readme
esbuild-plugin-bookmarklet
An ESM-only, Deno-first (supports node) plugin to generate bookmarklet code with esbuild!
Versioning
All releases after v1.0.0 are covered under semver
How to use
Deno
Add import bookmarkletPlugin from "https://deno.land/x/esbuild_plugin_bookmarklet@{VERSION}/mod.js"
Node
Add import bookmarkletPlugin from "esbuild-plugin-bookmarklet"
Then set the following parameters in your esbuild build script:
minify: true,
write: false,
format: 'iife',
plugins: [bookmarkletPlugin]
Example esbuild build scripts
Deno
import * as esbuild from "https://deno.land/x/[email protected]/mod.js";
import bookmarkletPlugin from "https://deno.land/x/esbuild_plugin_bookmarklet@{VERSION}/main.js"
esbuild.build({
entryPoints: ['index.js'], // points to normal javascript
bundle: true,
minify: true,
outfile: 'bookmarklet.js', // where to save bookmarklet javascript
write: false,
format: 'iife',
plugins: [bookmarkletPlugin],
target: ["chrome58", "firefox57", "safari11", "edge16"]
})
Node
import * as esbuild from "esbuild";
import bookmarkletPlugin from "esbuild-plugin-bookmarklet"
esbuild.build({
entryPoints: ['index.js'], // points to normal javascript
bundle: true,
minify: true,
outfile: 'bookmarklet.js', // where to save bookmarklet javascript
write: false,
format: 'iife',
plugins: [bookmarkletPlugin],
target: ["chrome58", "firefox57", "safari11", "edge16"]
})