Swaagie / minimize

Minimize HTML
MIT License
162 stars 18 forks source link

white space in attribute is not stripped #26

Closed stevemao closed 9 years ago

stevemao commented 9 years ago

i have some inline style in my div

<div style="margin: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
    -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
    background-position: 50% 50%;">
  </div>

But after minimize using gulp-minify-html the white spaces is still there (it could just make all the attribute values oneline).

Swaagie commented 9 years ago

Hmm yeah this is a tricky one, strictly speaking this would be outside the scope of the project. Strictly in the sense that CSS is not HTML. Currently, all values of attributes are left intact. But I do feel like that removing additional white spaces (keep one white space basically) and newlines from attributes wouldn't hurt. So I guess I can do something there, I'll release that as part of 1.0.0

stevemao commented 9 years ago

Sounds good. Yeah keeping one white space should work for attribute values in general

class="
    big
    title
"

can become

class="big title"

In order to further optimise inline css I should use another tool.

mlenser commented 9 years ago

This is actually the reason I am going to switch away from this minifier. Any hope of optionally allowing line breaks in attributes? For instance the value of an input.

Swaagie commented 9 years ago

As far as I'm aware this was fixed, if you have a example where it does not work please let me know. I'll make sure to fix that as well

mlenser commented 9 years ago

The behavior before this bug was fixed is what I desire.

Likely the way to allow for this is to implement ignoring areas between a specified comment.

Swaagie commented 9 years ago

Nvm my stupid previous comment, fixed and released with 1.5.0, simply pass whitespace: true to retain all whitespace/newlines in attributes

mlenser commented 9 years ago

Whitespace in attributes, nice!

Forgive my ignorance of the release schedule, but when you say "fixed and released", does that mean it will release in the future at some point? As I don't see any commits.

mlenser commented 8 years ago

Any eta on 1.5?

Swaagie commented 8 years ago

1.5 should be out, not sure about the integration with the gulp plugin, but that is outside my control.

npm info minimize output

     '1.3.3': '2015-04-03T07:17:53.369Z',
     '1.4.0': '2015-04-25T23:30:40.919Z',
     '1.4.1': '2015-04-29T07:26:47.843Z',
     '1.5.0': '2015-07-01T07:37:17.260Z' },
mlenser commented 8 years ago

I don't see any commits on this GitHub or any releases, which is why I'm asking.

https://github.com/Swaagie/minimize/commits/master https://github.com/Swaagie/minimize/releases

Gulp is indeed something else and I plan to ask them as soon as I confirm that 1.5 is released. But if you say it is I'll open an issue there for them to use your latest.

Swaagie commented 8 years ago

O haha, my bad, I totally forgot to push and tag :( thanks for notifying.

edit: will do now!