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
moduleexports = 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 = ;;
Options
dest
: Local path to folder in which to create embed support assets (required).destUrl
: URL pointing to thedest
folder on the target web server (optional, defaults toiframeUrl
).iframeUrl
: URL to set insrc
for the embedding iFrame (required).template
: Custom template forembed-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