UNPKG

embed-support

Version:

Create embed codes for a static web project

79 lines (56 loc) 2.1 kB
# 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](https://github.com/davidjbradshaw/iframe-resizer/blob/v2.8.10/js/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 ```shell npm install embed-support -g ``` ## Usage ### Passing options via command line ```shell 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` ```js module.exports = { dest: 'dist', destUrl: 'http://www.my-server.com/embed/', iframeUrl: 'http://www.my-server.com/embed/?lang=en' } ``` Then simply run ```shell 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 ```js 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 ```shell nvm use ``` Then run tests with ```shell npm test ```