Giter Club home page Giter Club logo

nsrosenqvist / gulp-retina-workflow Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 6 KB

A simple way to work with hires (retina) source images for your Gulp projects by automatically resizing them to smaller versions from a single source file. This means that you only need one hires image in your repo and don't need to create alternate versions of every single one.

License: MIT License

JavaScript 100.00%
gulp retina retina-images image-processing nodejs resize

gulp-retina-workflow's Introduction

gulp-retina-workflow

A simple way to work with hires (retina) source images for your Gulp projects by automatically resizing them to smaller versions from a single source file. This means that you only need one hires image in your repo and don't need to create alternate versions of every single one.

Prerequisites

  • Works in Node 5.0.0+ with Gulp.js.
  • Requires ImageMagick for Node. Please go there for installation directions and relevant questions.

Usage

const gulp = require('gulp');
const retina = require('gulp-retina-workflow');

gulp.task('images', function() {
    return gulp.src('images/**/*')
      .pipe(retina())
      .pipe(gulp.dest('dist/'));
});    

Features

The plugin automatically resizes hires images (@4x, @3x, @2x) to smaller versions so that you only need to create one source file with your highest supported scale, e.g. @4x. If you have multiple defined source images, for example @4x and @2x, then the @4x will be used to create the @3x and the @2x will be used to create the @1x, so that you can optimize your images for different dpi if you want to.

The plugin can work with any scale integers you wish since they are user defined. These are the default options:

{
  flags: [
    {suffix: '@1x', scale: 1, suffixOut: ''},
    {suffix: '@2x', scale: 2, suffixOut: '@2x'},
    {suffix: '@3x', scale: 3, suffixOut: '@3x'},
    {suffix: '@4x', scale: 4, suffixOut: '@4x'},
  ],
  extensions: ['jpg', 'jpeg', 'png'],
  roundUp: true,
  quality: 1
}

License

MIT

gulp-retina-workflow's People

Contributors

nsrosenqvist avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.