4/19/2024Deutsch
  • Home
  • Products
  • Services
  • Support
  • News
  • Denapp
  • Customers
  • Products
  • Denapp Bankdata Service
  • Order
  • Description
  • Prices
  • Documentation
  • Bankdata Client C# (.NET 2.0) Sample project
  • Services
  • Software Development
  • Web solutions
  • Support
  • Online Bankdata
  • Convert Bank account to SEPA
  • Calculate IBAN
  • Check SEPA Bank account
  • Check IBAN
  • Check German Bank account
  • Search for Bankdata
  • Online MEdi
  • Search in Payers listing
  • Search in Aid listing
  • Tools
  • Denapp HtmlShrink
  • Denapp CssImageInclude
  • Search
  • News
  • Denapp
  • Denapp Bankdata Service
  • Denapp
  • Contact
  • Terms of use
  • Privacy
  • Terms & Conditions
  • Imprint
  • Denapp HtmlShrink

    General

    There are many approaches to improve the performance of websites. One possibility is to compress the HTML code because smaller pages are transferred and the traffic will sink.
    There is already a long time the option of compression for Web pages through the server. However, between the advantages and disadvantages must be weighed, because this form of compression will burden on the CPU and causes different problems when pages should be cached.
    A much simpler, though not quite as effective option is the removal of unnecessary content from the HTML code!

    Whitespace

    To facilitate editing of Html pages for people, the code is created with line breaks and very large indentations. As a result, there are some websites with more than 30 percent of whitespace (space, tab's, line breaks). This data set will be called with each page as unnecessary weights, and wastes space in caching pages.

    What to do?

    In notice of some rules, removing of Whitespace does not influence the representation of a page at all. Thus it is recommended to clean up all HTML content, JavaScript- and CSS files of a site, after completion of the debugging, when no formatting is needed. With the free command line tool Denapp HtmlShrink you can remove unnecessary characters from a file or a number of files in a directory. In this way, some files are reduced to less than 70 percent of their original size.

    Denapp HtmlShrink is used for Html (.html, .aspx, .master, .cshtml etc.), JavaScript and CSS files. Thus, even ASP.Net Master pages can be shrinked before publication and then quickly processed and shipped by the server. Unnecessary whitespace like newlines and multiple spaces are removed from outside of HTML tag's. Within HTML tag's only newlines are removed, the remaining information is unchanged. In contrast to Html code, comments are removed from Javascript and CSS content.
    An important restriction must be observed when using this tool. If a line break is inserted within a paragraph during work with the HTML editor, it is necessary to place a blank before the line break if this is intended, since all subsequent whitespace is removed after line break's until the next text character, and consequently no space is available between words in different lines!

    Razor

    Additionally keep in mind when processing Razor files (.cshtml and others) the syntax '@:' to mark text cannot be used because all following characters until next line break are handled as text. Use the <text> tag instead. Insert an blank after the closing curly bracket of a @section definition before line break when another @section follows. An @model definition should stay at the end of the file. (The Razor Engine fails, if no blank splits @sections or no line break, just end of file, follows after @model definition.)

    Denapp HtmlShrink has not the goal to optimize HTML code! There are no changes in the form of exchange or simplicification of tag's made, but only unnecessary characters are removed. A review of the input files does not take place, the original code should be free of syntax errors.

    Use

    It should not be the adjustment to the original files, because the next change is determined. Rather, it is recommended to compress copies to be published before uploading to the web server.

    For execution, parameters for the path of the file/directory and when shrinking a directory a list of file extensions to be processed, are needed.

    Attention!
    Original files are overwritten during processing!

    Examples for command line

    The following example compresses the file 'Theme.css' in 'C:\Published' directory:

    htmlshrink.exe /target:"C:\Published\Theme.css"

    The following example compresses all files with the extensions '.aspx', '.ascx', '.master', '.cshtml', '.css' and '.js' in 'C:\Published' and subdirectories:

    htmlshrink.exe /target:"C:\Published"
    /.aspx /.ascx /.master /.cshtml /.css /.js

    Download Denapp HtmlShrink.

    Conclusion

    With compressed HTML pages you do not just save a lot of money, but also offer the surfers a faster site. Whether the described streamlining is enough or additional compression by the server must be activated varies from case to case. Removing the whitespace is in any case, the easiest, cheapest and most uncomplicated way to set up a powerful Web site design!