I have an annoying bug with Laravel producing whitespace characters into my source code when I use @extends
and @yield
.
For example, these are the first lines of my index.blade.php
file:
@extends('template.main')
@section('metas')
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@stop
And my template file starts like this :
<!DOCTYPE html>
<html lang="{{ Config::get('app.locale') }}">
<head>
@yield('metas')
And this is the output I get :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
As you can see, there are six whitespace characters at the very start of the file (before the DOCTYPE
declaration), and one before the first meta
element.
This is not something big but I'd like to find a way to fix it. I tried everything from using spaces, tabs, eliminating blank lines... but nothing has worked so far!