npm

embed-support

0.1.2 • Public • Published

Create embed codes for a static web project

Create a simple html page with embed codes and supporting script assets for embedding a web page in an auto-resizing iframe, based on iframe-resizer version 2.8.0.

The page to be embedded should contain iframeResizer.contentWindow.min.js.

The different types of embed codes are explained in the project documentation of embed-code, which this project uses for generating the embed codes.

Install

npm install embed-support -g

Usage

Passing options via command line

embed-support --dest='dist' \\
  --destUrl='http://www.my-server.com/embed/' \\
  --iframeUrl='http://www.my-server.com/embed/?lang=en' \\
  --verbose

Passing options via configuration object

Create file embed-support-config.js

module.exports = {
  dest: 'dist',
  destUrl: 'http://www.my-server.com/embed/',
  iframeUrl: 'http://www.my-server.com/embed/?lang=en'
}

Then simply run

embed-support --verbose

The tool looks by default for a configuration object from ./embed-support-config.js. You can also specify an alternative path for the configuration object with the --config option.

Usage via Javascript API

var embedSupport = require('embed-support');
embedSupport({
  dest: 'dist',
  destUrl: 'http://www.my-server.com/embed/',
  iframeUrl: 'http://www.my-server.com/embed/?lang=en'
});

Options

  • dest: Local path to folder in which to create embed support assets (required).
  • destUrl: URL pointing to the dest folder on the target web server (optional, defaults to iframeUrl).
  • iframeUrl: URL to set in src for the embedding iFrame (required).
  • template: Custom template for embed-codes.html (optional)

CLI-only options

  • config: Alternative path for configuration object.
  • verbose: Enable verbose output for command line.

Test

Make sure you have the correct node version

nvm use

Then run tests with

npm test

Package Sidebar

Install

npm i embed-support

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • lucify-master