Skip to content

reesericci/esbuild-plugin-bookmarklet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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