Skip to content

EvanHahn/node-html-pack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTML Pack for Node

Turns this...

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="the.css">
</head>
<body>
  <script src="vendor/jquery.js"></script>
  <script src="the.js"></script>
</body>
</html>

...into this (reformatted slightly):

<!DOCTYPE html><html><head><style>/* contents of the.css, minified */</style><body>
<script>/* contents of jquery then contents of the.js, minified */</script></body></html>

Here's how:

var path = require("path");
var pack = require("html-pack");

pack(path.resolve(__dirname, "index.html"), function(err, html) {
  console.log("index.html, inlined and minified:");
  console.log(html);
});

Not incredibly robust, so pull requests are welcome!

About

inline styles and scripts and minify everything

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published