area17 / blast

Storybook for Laravel Blade 🚀
https://dev.to/area17/getting-started-with-blast-storybook-for-laravel-blade-c5c
Apache License 2.0
262 stars 37 forks source link

[FEATURE-REQUEST] Use @stack directive #133

Closed yokozawa0701 closed 1 month ago

yokozawa0701 commented 1 month ago

Hi, We're using Alpine.js in my project. And I like using Alpine.store() with push directive rather than writing in HTML like below.

some-component.blade.html


<div data="darkMode"
  <!-- some component -->
</div>

@push('scripts')
  <script>
      document.addEventListener('alpine:init', () => {
          Alpine.store('darkMode', {
              on: false,

              toggle() {
                  this.on = ! this.on
              }
          })
      })
  </script>
@endpush

What do you think about making push directives available?

mrtimbrook commented 1 month ago

Hi! This should work out of the box. You'll need to publish the storybook.blade.php layout to your app using php artisan vendor:publish --provider="A17\Blast\BlastServiceProvider" --tag="blast-views" and then add the @stack directive there.

yokozawa0701 commented 1 month ago

@mrtimbrook

Oh, it's has work very well! Thanks!