2019-04-27 08:32:04 -04:00
|
|
|
<div align="center">
|
|
|
|
<h1>Embeddable React Widget</h1>
|
|
|
|
|
|
|
|
Easy creation of embeddable widgets - https://seriousben.github.io/embeddable-react-widget
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2018-06-03 11:05:02 -04:00
|
|
|
[](https://circleci.com/gh/seriousben/embeddable-react-widget)
|
|
|
|
[](https://codecov.io/gh/seriousben/embeddable-react-widget)
|
2019-04-27 08:32:04 -04:00
|
|
|
[](https://renovatebot.com/)
|
2018-05-29 22:14:07 -04:00
|
|
|
|
2019-04-27 08:32:04 -04:00
|
|
|
</div>
|
2018-05-26 14:53:54 -04:00
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
* Full ES6/ES2015 support (with Babel)
|
2018-06-03 11:02:07 -04:00
|
|
|
* Package fonts, css, json, javascripts together into one single package (with Webpack)
|
|
|
|
* No css styling conflicts between the host page and the widget (with https://github.com/premasagar/cleanslate)
|
2018-06-03 16:05:21 -04:00
|
|
|
* Bookmarklet supported for fast testing and demonstration
|
2018-05-27 21:31:47 -04:00
|
|
|
* User theming of widget
|
2018-05-26 14:53:54 -04:00
|
|
|
* Obfuscating of the widget code
|
2018-06-03 11:15:23 -04:00
|
|
|
* Unit Tested with code coverage enabled
|
|
|
|
* Continuous Integration ready
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2019-04-27 08:32:04 -04:00
|
|
|
## Demo
|
|
|
|
|
2019-04-27 09:04:32 -04:00
|
|
|
<img width="600px" src="./bookmarklet-flow.gif" />
|
2019-04-27 08:32:04 -04:00
|
|
|
|
2018-06-03 11:15:23 -04:00
|
|
|
## Running the widget
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2018-06-03 11:15:23 -04:00
|
|
|
### Install dependencies
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2018-06-03 11:15:23 -04:00
|
|
|
```sh
|
|
|
|
$ npm install
|
|
|
|
```
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2018-06-03 11:15:23 -04:00
|
|
|
### Start the development server
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ npm start
|
|
|
|
... server running at http://localhost:8080/
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run tests
|
|
|
|
```
|
|
|
|
$ npm test
|
|
|
|
... test output
|
|
|
|
```
|
|
|
|
|
|
|
|
### Production build
|
|
|
|
```
|
|
|
|
$ npm run build
|
|
|
|
... create files in /dist
|
|
|
|
```
|
2018-05-26 14:53:54 -04:00
|
|
|
|
|
|
|
## Roadmap
|
|
|
|
|
2018-05-27 21:31:47 -04:00
|
|
|
- [x] Widget as react app - index.html works (webpack, babel, react)
|
2018-05-29 21:56:01 -04:00
|
|
|
- [x] React widget (widget builder)
|
|
|
|
- [x] Webpack changed to output a library
|
|
|
|
- [x] Add tests
|
2018-06-03 11:15:23 -04:00
|
|
|
- [x] Add circleci integration
|
|
|
|
- [x] Add codecov integration for codecoverage
|
2018-05-30 20:45:33 -04:00
|
|
|
- [x] Production Build
|
|
|
|
- [x] Minified
|
2018-06-03 11:02:07 -04:00
|
|
|
- [x] Add greenkeeper
|
2018-06-03 16:05:21 -04:00
|
|
|
- [x] Bookmarklet
|
2018-06-09 09:50:36 -04:00
|
|
|
- [x] Reset / Cleanslate / No-conflicts of styles
|
|
|
|
- [x] Obfuscation
|
2018-05-27 21:31:47 -04:00
|
|
|
- [ ] Theming support
|
|
|
|
- [ ] Storyboard and docs
|
2018-06-09 09:50:36 -04:00
|
|
|
- [ ] Integrate eslint with webpack
|
2018-05-26 14:53:54 -04:00
|
|
|
|
2018-06-03 11:15:23 -04:00
|
|
|
## Background
|
|
|
|
|
|
|
|
### What is an embeddable widget?
|
|
|
|
|
|
|
|
* Usable using a simple `<script>` tag
|
|
|
|
* Configurable with code
|
|
|
|
* Themable
|
|
|
|
|
|
|
|
### Why not in an iframe?
|
|
|
|
|
|
|
|
* Interaction between the frame and the hosting page is tricky and not recommended
|
|
|
|
* You can only display content within the iframe
|
|
|
|
* iframe and content resizing is impossible
|
|
|
|
* iframe sandboxing can result in missing functionalities
|
|
|
|
|
|
|
|
### Read more
|
|
|
|
|
|
|
|
Read more about about widgets, react and scoping of css.
|
|
|
|
|
|
|
|
* https://www.robinwieruch.de/minimal-react-webpack-babel-setup/#hot-module-replacement
|
|
|
|
* https://codeburst.io/building-react-widget-libraries-using-webpack-e0a140c16ce4
|
|
|
|
* https://github.com/timarney/react-app-rewired
|
2018-05-26 14:53:54 -04:00
|
|
|
* https://github.com/premasagar/cleanslate
|
|
|
|
* https://github.com/krasimir/third-party-react-widget
|
|
|
|
* https://github.com/jenyayel/js-widget
|
|
|
|
* https://github.com/anakinjay/react-widget-starter
|
|
|
|
* https://webpack.js.org/guides/author-libraries/
|
|
|
|
* https://github.com/webpack-contrib/webpack-serve
|
|
|
|
* https://medium.freecodecamp.org/part-1-react-app-from-scratch-using-webpack-4-562b1d231e75
|
|
|
|
* https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.prod.js
|
|
|
|
* https://github.com/webpack-contrib/purifycss-webpack
|
|
|
|
* https://medium.com/quick-code/from-zero-to-deploy-set-up-react-stack-with-webpack-3-20b57d6cb8d7
|
|
|
|
* https://medium.com/dailyjs/building-a-react-component-with-webpack-publish-to-npm-deploy-to-github-guide-6927f60b3220
|
|
|
|
* http://krasimirtsonev.com/blog/article/javascript-library-starter-using-webpack-es6
|
|
|
|
* https://github.com/javascript-obfuscator/webpack-obfuscator
|
|
|
|
* https://github.com/tsileo/embedded-js-widget
|
|
|
|
* https://thomassileo.name/blog/2014/03/27/building-an-embeddable-javascript-widget-third-party-javascript/
|