bookmarklet-loader

1.0.0 • Public • Published

Bookmarklet loader for webpack

bookmarklet-loader is a webpack loader that will convert any javascript file into a bookmarklet that can be used as a module throughout your application.

Install

npm install bookmarklet-loader webpack --save-dev

The bookmarklet-loader requires webpack as peerDependency.

Usage

Apply via webpack config

module.exports = {
  ...
  module: {
    loaders: [
      {
        test: /\.js$/,
        loaders: ['bookmarklet-loader'],
        include: path.join(__dirname, 'app/bookmarklets')
      }
    ]
  }
};

Import into your application

import bookmarklet from 'app/bookmarklets/bookmarklet';
 
// via JSX
return (
  <a href={bookmarklet}>
    Click me, I am a bookmarklet.
  </a>
);
 
// via vanilla JS
let link = document.createElement('a');
    link.href = bookmarklet;
    link.innerHTML = 'Click me, I am a bookmaklet';
return link;

Dependencies (1)

Dev Dependencies (1)

Package Sidebar

Install

npm i bookmarklet-loader

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hootstheowl