Kirby Builder Preview and js

Is it possible to use js in the Kirby Builder Preview option? Although adding js is not mentioned in the Kirby Builder readme file, in the Builder snippet wrapper there is:

  <?php if ($page->_jspath()->isNotEmpty()): ?>
    <?= js($page->_jspath()) ?>
  <?php endif ?>

Can’t get this working, anybody using this successfully?

@timoetting?

Ok, will do, maybe I was getting lazy because of your amazing response time :rocket:

Hey @coko,

I don’t think that texnixe ment that you should write me a pm. I guess she just wanted to pull me into the the thread :slight_smile:

Javascript is currently not supported inside the builder block preview. The whole thing was unfortunately more difficult than hoped for, because the previews are re-rendered and initialized several times after they are moved and edited.

That was my intention, indeed :slightly_smiling_face:

:smirk: It did cross my mind …

Thanks for clearing that, was just curious. I was already convinced that having a 1:1 representation of the front end is not necessary at all. For some elements it’s nice to have css applied though, so happy with that and your plugin in general, thanks.

1 Like