mindtwo/laravel-blade-spaceless

Blade @spaceless directive that strips whitespace between HTML tags at render time.
36,440 2
Install
composer require mindtwo/laravel-blade-spaceless
Latest Version:1.5
PHP:^8.2
License:MIT
Last Updated:May 21, 2026
Links: GitHub  ·  Packagist
Maintainer: mindtwo

Spaceless Larvel Blade Directive

Latest Stable Version Total Downloads MIT Software License

Installation

You can install the package via composer:

composer require mindtwo/laravel-blade-spaceless

The package will register itself automatically.

Optionally you can publish the package configuration using:

php artisan vendor:publish --provider=mindtwo\\Spaceless\\SpacelessServiceProvider

How to use?

The new blade directives @spaceless and @endspaceless are now available in your blade views:

@spaceless
<!DOCTYPE html>
<html>
    <head></head>
    <body></body>
</html>
@endspaceless

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@mindtwo.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

hedronium/spaceless-blade

Adds the @spaceless tag to Blade. (works like in Twig)

656,904 31
spatie/laravel-blade-javascript

A Blade directive to export variables to JavaScript

937,970 620
fitztrev/laravel-html-minify

Minifies the HTML output of Laravel 4 applications

215,237 414
balping/laravel-blade-function

This Laravel 5.1+ package lets you declare functions inside blade templates.

10,461 21
yocmen/html-minify

Minifies the HTML output of Laravel 5 applications (Originally from https://gith...

13,735 16