rehypejs / rehype-minify

plugins to minify HTML
https://unifiedjs.com
MIT License
90 stars 16 forks source link

merge inline styles && scripts #2

Closed michael-ciniawsky closed 8 years ago

wooorm commented 8 years ago

As in, merging nodes?

I investigated moving style attributes to a <style> element (adding id’s to each element instead), but it didn’t help the GZipped output.

Are you here suggesting something like that, or more like concatenating <script> and <style> elements to one?

michael-ciniawsky commented 8 years ago

To concat multiple <style>.foo {}</style>and <script>var foo = 'bar'</script> tags if present into one for each type. How does the id reference for style attrs look like ? :)

<body>
   <style></style>
   <div></div>
   <script></script>

   <style></style>
   <div></div>
   <script></script>

   <style></style>
   <div></div>
   <script></script>
</body>
<body>
   <style>All..</style>

   <div></div>
   <div></div>
   <div></div>

   <script>All..</script>
</body>
wooorm commented 8 years ago

To concat multiple and tags if present into one for each type. How does the id reference for style attrs look like ? :)

In:

<div style="color: red"></div>
<div style="color: blue"></div>

Out:

<style>#a{color:red}#b{color:blue}</style><div id=a></div><div id=b></div>

(which should become useful at a certain amount of [style]s)