Skip to content

Commit

Permalink
Fixed bug in displaying error in compilation, updated README to show …
Browse files Browse the repository at this point in the history
…badges for all versions of Laravel >= 5
  • Loading branch information
Magentron committed Feb 1, 2023
1 parent 6c6ccfb commit c26b7fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Laravel Blade Lint

[![Laravel 5.7](https://img.shields.io/badge/Laravel-5.7-green.svg)](https://github.com/laravel/framework/tree/5.7)
[![Laravel 5.6](https://img.shields.io/badge/Laravel-5.6-green.svg)](https://github.com/laravel/framework/tree/5.6)
[![Laravel 5.5](https://img.shields.io/badge/Laravel-5.5-green.svg)](https://github.com/laravel/framework/tree/5.5)
[![Laravel 5.4](https://img.shields.io/badge/Laravel-5.4-green.svg)](https://github.com/laravel/framework/tree/5.4)
[![Laravel 10.x](https://img.shields.io/badge/Laravel-10.x-green.svg)](https://github.com/laravel/framework/tree/10.x)
[![Laravel 9.x](https://img.shields.io/badge/Laravel-9.x-green.svg)](https://github.com/laravel/framework/tree/9.x)
[![Laravel 8.x](https://img.shields.io/badge/Laravel-8.x-green.svg)](https://github.com/laravel/framework/tree/8.x)
[![Laravel 7.x](https://img.shields.io/badge/Laravel-7.x-green.svg)](https://github.com/laravel/framework/tree/7.x)
[![Laravel 6.x](https://img.shields.io/badge/Laravel-6.x-green.svg)](https://github.com/laravel/framework/tree/6.x)
[![Laravel 5.x](https://img.shields.io/badge/Laravel-5.x-green.svg)](https://github.com/laravel/framework/tree/5.8)

Laravel console command to check syntax of blade templates.

Expand All @@ -18,7 +20,7 @@ Perhaps it works with lesser versions as well, but this is untested.

Add package via composer:

composer require magentron/laravel-blade-lint
composer require --dev magentron/laravel-blade-lint

For Laravel version < 5.5, edit `config/app.php`, add the following to
the `providers` array:
Expand Down
9 changes: 7 additions & 2 deletions src/Magentron/BladeLint/Console/Commands/BladeLint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class BladeLint extends Command
*
* @var string
*/
protected $signature = 'blade:lint {path?*}';
protected $signature = 'blade:lint
{--debug : Enable debug output, which consists of the compiled templates (PHP code)}
{path?*}';

/**
* The console command description.
Expand Down Expand Up @@ -142,10 +144,13 @@ protected function checkBladeSyntaxFiles(array $blades)

// compile the file and send it to the linter process
$compiled = Blade::compileString(file_get_contents($file));
if ($this->input->getOption('debug')) {
$this->comment($compiled, OutputInterface::VERBOSITY_QUIET);
}

if (! $this->lint($compiled, $output, $error)) {
++$errorCount;
$error = str_replace("Standard input code", $file->getPathname(), rtrim($error));
$error = str_replace("Standard input code", $file, rtrim($error));
$this->error($error, OutputInterface::VERBOSITY_QUIET);
$maxMessageLength = 0;
}
Expand Down

0 comments on commit c26b7fb

Please sign in to comment.