html-compat

Make HTML file compatible with legacy browsers by transpiling script and style tag.

MIT License

Downloads
4
Stars
4
Committers
1

html-compat

How does it work?

If you simply want to work with an index.html and love ES2015, CSSnext features, all script and style tags inside the html file will be transpiled to more compatible JS/CSS.

Here's nothing magic and worths studying, just a simple short-hand to reduce boilerplate code 😄

Install

npm i -g html-compat

Usage

html-compat input.html -o output.html

# help
html-compat -h

API

const htmlCompat = require('html-compat')

htmlCompat(`<html>html string</html>`, options)
  .then(result => {
    console.log(result)
  })

options

browsers

Type: Array Default: ['ie > 8', 'last 4 versions']

Support browsers down to this value.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

html-compat © egoist, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @_egoistlily