Skip to content

Latest commit

 

History

History
82 lines (61 loc) · 2.08 KB

README.md

File metadata and controls

82 lines (61 loc) · 2.08 KB

esbuild-plugin-bookmarklet

license type this is an ESM module deno supported node supported npm version

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 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

Node

  • 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]

Example esbuild build scripts

Deno

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"]
})

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"]
})