GithubHelp home page GithubHelp logo

renditioner's Introduction

renditioner

Renditioner is a NodeJS Image Rendition Generator. It uses sharpjs to generate a given set of Renditions in a given set of filetypes.

Installing

npm i renditioner

Usage

import { renderImages } from 'renditioner';

const sources = 'src/images/**/*.*';
const renditions = [
  {
    width: 1224,
  },
  {
    width: 220,
    height: 165,
  },
  {
    width: 200,
    height: 150,
  },
];
await renderImages({ sources, fileTypes: ['webp', 'jpeg'], renditions, basedir: "src/images/", target: "dist" });

RenderOptions

key description
sources: glob or Array of glob describing paths to all image you want to be processed
fileTypes: Array the target-filetype you want your images to be rendered in ('webp', 'jpeg')
renditions: Array of all Renditions you want to be processed
basedir: releative path-anchor to create target paths (defaults to rootdir)
target: target path

Rendition

Renditions are defined as objects with with and height (optional)

interface Rendition {
  width: number;
  height?: number;
  aspectRatio?: string; // (e.g. 16:9)
}

renditioner's People

Contributors

friewerts avatar

Watchers

 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.