DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
224 stars 79 forks source link

Better HTML output formatting #98

Closed RichardReddy closed 10 years ago

RichardReddy commented 10 years ago

Hi,

This isn't a bug but it would be great if some time in the future it would be possible to put line breaks in the HTML output?

For example right now a textbox is rendered like this in the HTML source code:

<div class="form-group"><label class="control-label col-lg-2" for="Name">Name<span class="required">*</span> </label><div class="col-lg-10"><input class="form-control" data-val="true" data-val-required="The Name field is required." id="Name" name="Name" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="Name" data-valmsg-replace="true"></span></div></div>

But it would be so much easier to read in the source code if it could be rendered like this with line breaks:

<div class="form-group">
        <label class="control-label col-lg-2" for="Name">Name<span class="required">*</span> </label>
        <div class="col-lg-10">
            <input class="form-control" data-val="true" data-val-required="The Name field is required." id="Name" name="Name" type="text" value="" />
            <span class="field-validation-valid" data-valmsg-for="Name" data-valmsg-replace="true"></span>
        </div>
    </div>

Perhaps this is already possible and I am overlooking a setting?

As I said, I don't need this done today but it would be a 'nice to have' for a future release. Loving this tool so far. Keep up the great work :)

Rich

gicalle commented 10 years ago

when implementing this, let it be a global setting. some like it to be compact, others like it to be 'formatted'

RichardReddy commented 10 years ago

Good point but if you had gzip setup in IIS you'd be covered from a bandwidth point of view wouldn't you? No harm in making it a toggle though :)

DmitryEfimenko commented 10 years ago

Perhaps there are different ways of setting up gzip, but I used to set it up in MVC project through action filters so that it's applied to the whole html output,

Also, having it spit out BMVC html without breaks never been an issue for me since Google Chrome dev tools does the formatting automatically for you and that's the tool I use for debugging of html.

Implementing breaks would also mean implementing spaces or tabs probably. That would be REALLY big change and I'd rather avoid it. What tools do you use that don't format html for you? Perhaps it would be easier to just start using the right tools :)

RichardReddy commented 10 years ago

Ya, I thought it might be a big change. Every single control would need to be altered which would be a nightmare.

It was only a suggestion and as you rightly pointed out Google dev tools does this automatically for me so you can ignore this request.

It only came about when I was showing a designer the source code produced and they asked about the format of the output. I didn't actually know that the Google Dev Tools did this automatically so it's good to know!

Thanks for the reply.

Rich

DmitryEfimenko commented 10 years ago

Awesome! Gladly closing this one!