How to use the gatsby-plugin-sharp.sizes function in gatsby-plugin-sharp

To help you get started, we’ve selected a few gatsby-plugin-sharp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cameronwp / hurtling-through-space / plugins / gatsby-remark-images-full-width / index.js View on Github external
'use strict';

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

var select = require('unist-util-select');
var path = require('path');
var isRelativeUrl = require('is-relative-url');
var _ = require('lodash');

var _require = require('gatsby-plugin-sharp'),
    sizes = _require.sizes;

var Promise = require('bluebird');
var cheerio = require('cheerio');
var slash = require('slash');
var regeneratorRuntime = require('regenerator-runtime/runtime');

// If the image is relative (not hosted elsewhere)
// 1. Find the image file
// 2. Find the image's size
// 3. Filter out any responsive image sizes that are greater than the image's width
// 4. Create the responsive images.
// 5. Set the html w/ aspect ratio helper.
module.exports = function (_ref, pluginOptions) {
  var files = _ref.files,
      markdownNode = _ref.markdownNode,
      markdownAST = _ref.markdownAST,

gatsby-plugin-sharp

Wrapper of the Sharp image manipulation library for Gatsby plugins

MIT
Latest version published 3 months ago

Package Health Score

88 / 100
Full package analysis

Popular gatsby-plugin-sharp functions