Giter Site home page Giter Site logo

marko-36 / gulp-responsive-config Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mahnunchik/gulp-responsive-config

0.0 0.0 0.0 6 KB

Config generator for gulp-responsive

Home Page: https://www.npmjs.com/package/gulp-responsive

JavaScript 100.00%

gulp-responsive-config's Introduction

gulp-responsive-config

gulp-responsive-config helps to generate gulp-responsive configuration from existiong HTML and CSS files.

Usage

HTML layout

<img srcset="image-200x300.jpg 1x, [email protected] 2x">

CSS markup

.image {
  /* fallback */
  background-image: url("background-image-x200.png");
  /* image-set */
  background-image: image-set("background-image-x200.png" 1x,
                              "[email protected]" 2x,
                              "[email protected]" 3x);
}

gulp-responsive & gulp-responsive-config

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();

gulp.task('images', ['css', 'html'], function () {
  // Make configuration from existing HTML and CSS files
  var config = $.responsiveConfig([
    'public/**/*.css',
    'public/**/*.html'
  ]);

  return gulp.src('images/*.{png,jpg}')
    // Use configuration
    .pipe($.responsive(config, {
      errorOnEnlargement: false,
      quality: 80,
      withMetadata: false,
      compressionLevel: 7,
    }))
    .pipe(gulp.dest('public/images'));
});

Supported filename format for dimensions detect

  • -<width>: image-100.png
  • -<width>x: image-100x.png
  • -<width>x<height>: image-100x200.png
  • -x<height>: image-x200.png
  • -<width>x<height>@<scale>x: [email protected]
  • @<scale>x: [email protected]

See also parse-image-dimensions module.

License

MIT

gulp-responsive-config's People

Contributors

mahnunchik avatar martinhoefling 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.