Documentation ¶
Overview ¶
Package whitespace implements a middleware plugin to remove whitespace from web-pages generated by your web-server.
Copyright © 2020, 2022 M.Watermann, 10247 Berlin, Germany All rights reserved EMail : <support@mwat.de>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License along with this program. If not, see the [GNU General Public License](http://www.gnu.org/licenses/gpl.html) for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // `UseRemoveWhitespace` (default: `true`) determines whether the // removal of whitespace is actually run. // If set to `false` the `Remove()` function becomes basically a NoOp. // // This flag allows you to include the `Wrap()` and/or `Remove()` // functions in your code and change your program's actual behaviour // according to some configuration setting or commandline option: // You'd just change this flag accordingly at runtime without changing // your source code at all. UseRemoveWhitespace = true )
Functions ¶
func Remove ¶
`Remove` returns `aPage` with HTML comments and unnecessary whitespace removed.
Depending of the global `UseRemoveWhitespace` flag this function removes all unneeded/redundant whitespace and HTML comments from the given `aPage`. This can reduce significantly the amount of data to send to the remote user agent thus saving both bandwidth and transfer time.
Parameters:
- `aPage`: The web page's HTML markup to process.
Returns:
- `[]byte`: The cleansed page.
Types ¶
This section is empty.