Formatting of dynamically generated HTML - does no one care?

前端 未结 13 1761
不知归路
不知归路 2021-01-11 17:10

I have very little experience in web development, so this may be a very basic question.

It\'s just, from the limited experience I do have (

相关标签:
13条回答
  • 2021-01-11 17:21

    The HAML templating engine was specifically created with the goal of generating properly indented, nested and formatted HTML. There's no reason why other templating engines couldn't do the same.

    So, yes, it is just laziness.

    0 讨论(0)
  • 2021-01-11 17:21

    It can be annoying when I am trying to look at the source to see where a div or style may be missing. I always try to generate any html with a decent layout because 9/10 it would be me that would have to look for bugs.

    So, from my point of view it does matter, even if it is not number one priority it should come in as priority 2 or at the very least 3, in my opinion of course.

    Nowadays, as a C# developer, I usually copy the source code to Visual Studio and do a ctrl+k+f to indent the code so it is far easier to see.

    It is possible and most likely that other IDE's have similar functions available for developer that have this kind of minor annoyance.

    0 讨论(0)
  • 2021-01-11 17:21

    Almost all respectable ides have a shortcut for auto-formatting: Visual Studio - ctrl+k+f Netbeans - alt+shift+f Eclipse - ctrl+shift+f

    So I think is no need for formatting.

    0 讨论(0)
  • 2021-01-11 17:22

    If I was going to send my page through any tool, it would be a minifier.

    Unfortunately, the browser's don't host a code beauty pageant :)

    0 讨论(0)
  • 2021-01-11 17:28

    I never really care because if I want to look at HTML nicely formatted I can just run it though TIDY before I look at it.

    0 讨论(0)
  • 2021-01-11 17:29

    Well if you make an extra pass over the file to beautify it before sending it to the user you will:

    1. Increase the file size (slower to download), and so give your users the feeling that your site is "lagging" and slow (which it is)

    2. put extra overhead on your server, possibly maxing it out and slowing down even more

    Besides helping one or two guys who read the source code (which can be automatically beautified in most editors), what do you hope to accomplish with this to make it worth it?

    0 讨论(0)
提交回复
热议问题