JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q48564F
  • License ISC

Generate OG Images automatically using Gulp and node-canvas

Package Exports

  • gulp-ogimage
  • gulp-ogimage/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-ogimage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-ogimage

Generates Og Images automatically using Gulp

Usage

var gulp_og_image = require("gulp-ogimage");

var ogImage = function() {
  return gulp.src("./build/templates/*.html")
  .pipe(
    gulp_og_image({
      base : function() {
        return "https://example.com/images/og";
      },

      directory : function() {
        return "./build/images/og"
      },

      backgroundImage : function() {
          // Optional: Add a background image
        return "./srcs/images/common/og/background.png"
      },

      title : function(file, $) {
          // Cheerio query selector
        return $("h1").first().text();
      },

      description : function(file, $) {
          // Cheerio query selector
        return $("p").first().text();
      }
    })
  ).pipe(
    gulp.dest(
      "./templates"
    )
  );
};

gulp.start(ogImage)