Omit formatted comments from minification


#1

I’d like to keep some comments w/in a HTML page that is minified by cloudflare. Credits and ascii art, for examples.
Currently it is said “Inline CSS or JS embedded inside your HTML code will not be minified”.
So a workaround would be to create a style or script tag and put comments in there. I don’t like that idea though.
Something nicer would be:

<!––nomin––>
<!––
Formatted Credits Block
© 2018 bla bla bla
¯\ _ (ツ)_/¯
––>
<!-––/nomin––>

Just like Server-Side-Excludes, cloudflare would parse this section and know not to minify it.


#2

@jules - thanks for this request. It should be possible for us to do this - I’m interested to see if anyone else in the community would use this so please comment if you’re reading and let us know your use-case.


#3

A few use cases.

  1. Leaving comments in a public optimized site for remote team members’ help - developers and designers.

  2. Getting our own credit in there, publicly.

  3. Showing a client I built their site with care.


#4

Very pretty! If there are other folk who would like this feature please let us know.


#5

I would use it for a few things.

  1. Including contact information, especially for security researchers
    (security.txt is starting to help, but there are other times when it can
    be useful to include contact information intended only for a more
    technical audience).

  2. Including credits. These are plainly displayed to users in a
    dedicated page, but I like giving credit to web and graphic designers in
    as many places as possible to make it as easy for a prospective customer
    to contact someone who’s services I use and endorse).

But the one that really matters is mostly for me:

  1. I throw lots of data into comments to help troubleshoot issues. This
    includes which backend server served a response, some details about the
    user’s status. Details like are they logged in? What is their session ID
    or other unique identifier? Were they assigned any special flags (A/B
    testing and similar, which may not be tied to an account or specific
    session if the site doesn’t use these). What is the timestamp when the
    page was generated (for connecting the request to server side logs).

There are tons of other ways to handle this situation, but comments are
relatively easy for semi-technical users to retrieve and send to me, the
instructions are pretty much just “Press CTRL U, copy the top lines
until the ‘Stop copying here’ line, paste into a reply to this email”


#6

Another use case… some CMSs and wordpress plugins add comments to the bottom of the page regarding their output and function, so you know it’s working.
CF’s optimization removes them.

So for example I see this in a client’s blog:

But it could / should be this:
23%20PM

Perhaps removing white space and removing comments can be separate options?