twolfson / grunt-html-prettyprinter

Grunt task that beautifies your HTML
MIT License
13 stars 1 forks source link

Flag to turn javascript formatting off #1

Closed coen-hyde closed 11 years ago

coen-hyde commented 11 years ago

Thanks for the grunt task.

I noticed this task also formats javascript. It would be good if it had a flag to turn this functionality off.

twolfson commented 11 years ago

Not a problem. Unfortunately, this repo is just a grunt wrapper around maxogden/commonjs-html-prettyprinter.

It might be possible with adding script to the unformatted option but that is best tested in a proof of concept.

Care to give it a go?

twolfson commented 11 years ago

Looking into this: https://gist.github.com/4167514 Should have our answer in a second.

twolfson commented 11 years ago

I am not seeing the JS auto-formatting as you described; the output I get from my gist is

<div>
    <div>
        <div>
            <script>
                console.log('hey');console.log('what\'s up doc?');console.log('nada mucho senor');
            </script>
        </div>
    </div>
</div>

which is unformatted JS. Can you provide me with a better test case?

coen-hyde commented 11 years ago

Hi twolfson,

Thanks for investigating. I figured it out, here's my fork https://gist.github.com/4167690. It was as simple as html npm package versions. grunt-html-prettyprinter uses on html@0.0.6 while the gist used html@0.0.7. I'll submit a pull request in a sec.

Thanks, Coen

twolfson commented 11 years ago

Awesome! Thanks, I will merge that right away.

I still do like having the option of beautifying/not beautifying inline-js but it seems our fate is cast to the windows of other modules. I will probably open an issue to add it as an option =P

twolfson commented 11 years ago

Bumped version to 1.1.0 and published to npm. You should be all set =)

coen-hyde commented 11 years ago

Thanks