shkuznetsov / gulp-minify-inline

gulp plugin that minifies inline JS and CSS
MIT License
28 stars 5 forks source link

Fully minify HTML? #16

Closed tomasdev closed 7 years ago

tomasdev commented 7 years ago

If you minify the following:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/contentful-ui-extensions-sdk@2/dist/cf-extension.css">
<style>
section {
  border-bottom: 1px solid rgba(0, 0, 0, .2);
  padding-bottom: 2em;
  margin-bottom: 2em;
}
.cf-form-field {
  margin-left: 1em;
}
</style>
</head>
<body>
  <div id="content"></div>
  <script src="https://unpkg.com/contentful-ui-extensions-sdk@2"></script>
</body>
</html>

Produces the following:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/contentful-ui-extensions-sdk@2/dist/cf-extension.css">
<style>section{border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:2em;margin-bottom:2em}.cf-form-field{margin-left:1em}</style>
</head>
<body>
<div id="content"></div>
<script src="https://unpkg.com/contentful-ui-extensions-sdk@2"></script>
</body>
</html>

Instead of:

<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="https://unpkg.com/contentful-ui-extensions-sdk@2/dist/cf-extension.css"><style>section{border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:2em;margin-bottom:2em}.cf-form-field{margin-left:1em}</style></head><body><div id="content"></div><script src="https://unpkg.com/contentful-ui-extensions-sdk@2"></script></body></html>

Is there any configuration option for removing new lines?

joedajigalo commented 7 years ago

Hey @tomasdev,

Have you tried using gulp-minify-inline w/ Web Starter Kit?

You can use WSK for development locally, and when you're ready to build, it will minify the HTML, and gulp-minify-inline will minify the inline css and js.

Here is an example: josephvan.xyz

image

Notice my JS is inline - but when I am building, it is minified:

image

Let me know if this is what you are considering to do.

tomasdev commented 7 years ago

I ended up using nginx pagespeed to minify the output.