unified

Project: rehypejs/rehype-minify

Package: rehype-javascript-to-bottom@2.0.2

  1. Dependencies: 2·Dependents: 0
  2. rehype plugin to move JavaScript <script> to <body>
  1. unified 140
  2. plugin 125
  3. html 101
  4. rehype 69
  5. rehype-plugin 49
  6. minify 30
  7. mangle 30
  8. script 10
  9. javascript 10
  10. head 3
  11. move 3
  12. js 2

rehype-javascript-to-bottom

Build Coverage Downloads Size Sponsors Backers Chat

Move JS <script> elements to the end of <body>.

This can decrease the time to first render.

You can pass filter, a function called with each checked node, returning true if the script should be moved, and false if not.

Install

npm:

npm install rehype-javascript-to-bottom

Example

In
<!doctype html><html><head><script src="index.js"></script></head><body></body></html>
Out
<!doctype html><html><head></head><body><script src="index.js"></script></body></html>

Contribute

See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer