Nanananananananana.. Pat Man!
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

gulp-bookmarklet

1.0.0 • Public • Published

gulp-bookmarklet

Gulp wrapper for the bookmarklet package used to generate multiple bookmarklets from source.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-bookmarklet

Usage

No arguments are required for usage. By default a call to gulp-bookmarklet with no arguments will generate bookmarklet code for each source file in minified js files.

var bookmarklet = require('gulp-bookmarklet');

gulp.task('bookmarklet', function() {
    return gulp.src('src/*.js')
        .pipe(bookmarklet())
        .pipe(gulp.dest('min.js'));
});

To generate bookmarklets in a different format, call gulp-bookmarklet with parameter object {format: '???'} where ??? may be one of:

  • js - minified bookmarklet text (Default)
  • html - generate bookmark files using netscape-bookmarks to allow for easy import into web browser
  • htmlsingle - same as html except all bookmarklets are exported to a single html file
    • Additional parameters: file - Custom filename for the output file generated, default name is bookmarklets.html

Below is an example of using htmlsingle with a custom file name:

var bookmarklet = require('gulp-bookmarklet');

gulp.task('bookmarklet', function() {
    return gulp.src('src/*.js')
        .pipe(bookmarklet({
            format: 'htmlsingle',
            file: 'awesome.html'
        }))
        .pipe(gulp.dest('./'));
});

Keywords

install

npm i gulp-bookmarklet

Downloadsweekly downloads

4

version

1.0.0

license

GPL-3.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability