Skip to content

antonlashan/js-embed-widget

Repository files navigation

Javascript embed widget

Getting Started

You have to just copy paste this script end of the body tag of your main index file (index.html or index.php)

To enable just after page load

(function (w, d, s, f, js, fjs) {
  (js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
  js.src = f;
  js.async = 1;
  fjs.parentNode.insertBefore(js, fjs);
})(window, document, 'script', './widget.js');

minified version

// prettier-ignore
(function(a,b,c,d,e,f){e=b.createElement(c),f=b.getElementsByTagName(c)[0],e.src=d,e.async=1,f.parentNode.insertBefore(e,f)})(window,document,"script","./widget.js");

Development

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

node v12 or higher

Installing

Build

You can easily build with environments

yarn build
or yarn build:testing
or yarn build:prod

Deployment

Comming soon


NOTE

Steps to run docker locally

  • Install docker
  • Build image with environment specific docker build --build-arg appEnv=prod -t embed_widget .

if appEnv doesn't specify then default env will be the testing

  • Run the docker docker run -p 80:80 embed_widget