gulp-generate-image-data-uri

1.1.0 • Public • Published

gulp-generate-image-data-uri

Does exactly as it says on the tin. A gulp plugin to generate datauris for images.

Install

I use Yarn, and love it. I totally recommend using it as well!

To install via Yarn:

$ yarn add gulp-generate-image-data-uri -D

To install via npm:

$ npm install gulp-generate-image-data-uri -D

Usage

As with most Gulp plugins, this is relatively easy to set up.

const gulp = require('gulp');
const dataURI = require('gulp-generate-image-data-uri');
 
gulp.task('default', () =>
    gulp.src('src/img.jpg')
        .pipe(dataURI())
        .pipe(gulp.dest('dist'))
);

This will output a file, img.txt, which contains the data-uri.

API

datauri([options])

options

isJS

Type: boolean
Default: false

Outputs datauris to JS instead, one defintion per file. The format being:

const camelCaseFileName = 'dataURI';

Credit

This plugin would not be possible without the Node module datauri, which is used to generate the datauris

License

MIT © Aaron Kelly-Barker

/gulp-generate-image-data-uri/

    Package Sidebar

    Install

    npm i gulp-generate-image-data-uri

    Weekly Downloads

    1

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    4.11 kB

    Total Files

    5

    Last publish

    Collaborators

    • ackellyb