An ESM-only, Deno-first (supports node) plugin to generate bookmarklet code with esbuild!
All releases after v1.0.0 are covered under semver
Add to the top of your build script:
import bookmarkletPlugin from "https://deno.land/x/esbuild_plugin_bookmarklet@{VERSION}/mod.js"
Replacing {VERSION}
with the current released version
-
Run
npm i esbuild-plugin-bookmarklet
-
Add to the top of your build script:
import bookmarkletPlugin from "esbuild-plugin-bookmarklet"
Then set the following parameters in your esbuild build script:
minify: true,
write: false,
format: 'iife',
plugins: [bookmarkletPlugin]
import * as esbuild from "https://deno.land/x/esbuild@v0.17.11/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"]
})
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"]
})