TerrePorter / StringBladeCompiler

Render Blade templates from string
MIT License
175 stars 76 forks source link

Breaks other packages that contain custom blade directives #73

Closed AdamGaskins closed 1 year ago

AdamGaskins commented 3 years ago

I installed spatie/laravel-ray which has a @ray() directive for debug output, however the only way I can get this directive to work is by:

  1. Adding spatie/laravel-ray to my composer.json's dont-discover:
      "extra": {
          "laravel": {
              "dont-discover": [
                  "spatie/laravel-ray"
              ]
          }
      },
  2. Add the StringBladeCompilerServiceProvider to my app.php directly after the standard ViewServiceProvider (and I comment it out too because it seems to be more consistent that way):
    //        Illuminate\View\ViewServiceProvider::class,
        \Wpb\String_Blade_Compiler\StringBladeServiceProvider::class,
  3. Add the RayServiceProvider at the end of my app.php
  4. Run php artisan view:clear
danielzzz commented 2 years ago

it breaks also livewire. @livewireStyles and @livewireScripts don't work with this library

I did the same like you with laravel-ray and it worked for me. thanks!

AdamGaskins commented 2 years ago

I made my own similar library that does the same thing without needing to replace the ViewServiceProvider. We've been using it in our products at my work this year. adamgaskins/view-string

danielzzz commented 2 years ago

thats cool, thanks!