diffrentdigital/remove-html-comments

Removes HTML comments from Statamic responses.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:statamic-addon

dev-main 2025-01-07 15:09 UTC

This package is auto-updated.

Last update: 2025-01-07 15:10:03 UTC


README

Latest Version on Packagist Total Downloads License

This Statamic add-on removes HTML comments (<!-- ... -->) from responses before they are sent to the browser, optimizing your website's output.

Features

  • Automatically strips all HTML comments from text/html responses.
  • Lightweight middleware with minimal performance overhead.
  • Seamlessly integrates with Statamic.

Installation

You can install the package via Composer:

composer require diffrentdigital/remove-html-comments

Usage

Once installed, the add-on is automatically registered in your Statamic application. It runs as middleware for all routes in the web middleware group.

How It Works

  • The middleware processes all HTML responses.
  • It identifies HTML comments using a regex pattern and removes them.

No additional configuration is required. 🎉

Performance Considerations

This add-on is designed to have minimal impact on performance. It only processes responses with the Content-Type header set to text/html.

Profiling

If you experience any performance concerns, you can use Laravel Debugbar or other profiling tools to measure middleware execution time.

License

This package is open-sourced software licensed under the MIT license.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

To Contribute:

  1. Fork the repository.
  2. Make your changes in a feature branch.
  3. Submit a pull request.

Acknowledgments

This add-on was created by delz-dev.

Support

If you find this add-on useful, please consider starring the repository on GitHub or sharing it with others. 😊