https://twill.io logo
Join Discord
Powered by
# 📃headless
  • i

    ifox

    01/05/2023, 12:10 PM
    Thanks @antonioribeiro. I don't think this shows how to set up block transforms but the docs in the package README do @Erwin. You may also want to look into https://github.com/area17/twill-api and https://github.com/area17/twill-api-client
  • g

    ghostfacedlover

    01/29/2023, 9:06 PM
    are there any headless tutorials?
  • i

    ifox

    01/31/2023, 3:20 PM
    Libraries but no tutorials yet. More to come with the Twill 3 release! There will be a Nuxt 3 example.
  • k

    kerkness

    02/01/2023, 8:16 PM
    Is the develop branch of area17/twill-api compatible with 3.x?
  • i

    ifox

    02/01/2023, 8:17 PM
    yes
  • i

    ifox

    02/01/2023, 10:30 PM
    the documentation for initial setup needs a bit more work, we're on it
  • k

    kerkness

    02/02/2023, 2:24 AM
    I'm actually a bit undecided now if I want to go headless. The intention isn't to provide content or data to a JS based site (nuxt,react,ect) but rather "static" content to a laravel project which uses my own package for dynamic products and procurement. The only cross over between the two schemas are "files" which I don't really require on the Twill side anyway. It's looking like the two packages will play nicely together so, considering running them both in the same project.
  • i

    ifox

    02/02/2023, 11:49 AM
    that makes sense. And yes Twill is definitely made to play nicely with the rest of your Laravel codebase
  • a

    andy_a

    02/24/2023, 10:06 AM
    Hello! I am evaluating Twill as a headless cms and I really like the architecture and admin functionality. But I am not able to get twill-api running - I am always getting "Server v1 does not exist in config or is not a valid class." as a RuntimeException when requiring it. I tried laravel9/twill3/twill-api:dev-develop and laravel8/twill2/twill-api:dev-main with the same error. Do I miss something?
  • h

    Harings Rob

    02/24/2023, 10:09 AM
    hey @andy_a a quick search brought me this, https://github.com/cloudcreativity/laravel-json-api/issues/32 may be related?
  • a

    andy_a

    02/24/2023, 10:11 AM
    Thanks @Harings Rob , will look into it.
  • a

    andy_a

    02/24/2023, 10:43 AM
    That's from the wrong repository, twill-api is using laravel-json-api/laravel
  • a

    andy_a

    02/24/2023, 10:47 AM
    I investigated and I think there is some installation step missing. I was successful by creating a laravel-json-api server and configuring it in config/jsonapi.php. To do that, I had to disable the api routes first. There is an example server in twill-api/skeleton which I used.
  • i

    ifox

    02/24/2023, 11:01 AM
    Hey @andy_a the Twill API docs need some work for the install steps, the config from laravel-json-api needs to be published.
  • a

    andy_a

    02/24/2023, 11:03 AM
    Yes, and the Server needs to be created. The problem is that the runtime error occurs on each artisan command, so I had to disable the route in twill-api/routes/api.php
  • i

    ifox

    02/24/2023, 11:06 AM
    Right! It's on our list to fix that in time for the Twill 3 release and annoucements. We're also working on a full installable example with a Nuxt 3 app consuming it through area17/twill-api-client, with Typescript support!
  • i

    ifox

    02/24/2023, 11:08 AM
    https://github.com/area17/twill-api-client
  • a

    andy_a

    02/24/2023, 11:11 AM
    That sounds great!
  • z

    zynth

    03/08/2023, 9:46 PM
    that sounds dope
  • e

    Erwin

    03/17/2023, 3:21 PM
    Is there a way to get block editor previews without making a file for each block, like a global file that is gotten on all blocks?
  • p

    pboivin

    03/17/2023, 3:37 PM
    I don't think there's a way to do this globally but one simple solution would be to manually map all blocks to one view :
    Copy code
    $item->renderBlocks(true, [
        'my-block-1' => 'my.custom.view',
        'my-block-2' => 'my.custom.view',
        // ...
    ]);
    You could wrap it in a helper function to avoid copy-pasting the view mappings all over.
  • i

    ifox

    03/17/2023, 3:42 PM
    👋 @pboivin, I think @Erwin isn't using renderBlocks in a headless context, but your comment would still work if done at the twill.php config level
  • p

    pboivin

    03/17/2023, 3:47 PM
    Makes sense! I skipped over a few words apparently 😅
  • e

    Erwin

    03/17/2023, 4:00 PM
    Ah i understand, thanks!
  • e

    Erwin

    03/17/2023, 4:10 PM
    Do you guys know of a more effective way to do a headless block editor preview instead of storing every little edit in the cache and getting it via preview token in the iframe?
  • p

    pboivin

    03/17/2023, 4:20 PM
    Have you tried a full-page (module) preview, instead of individual block previews?
  • e

    Erwin

    03/17/2023, 5:41 PM
    Yes i have the the full-page preview working, now i'm just trying to get the block editor preview working. If i want to do it the same way as i'm doing the full-page previews it will store something in cache every time the input changes.
  • p

    pboivin

    03/17/2023, 5:59 PM
    Ok I see, I wasn't sure if you had worked on the page preview yet. On a previous project, my colleague had disabled the block editor preview entirely. The client used the inline block editor (in the form) to enter content and the full-page preview was their way of seeing the blocks in context. It worked pretty well.
  • i

    ifox

    03/17/2023, 6:00 PM
    What's your concern with the cache? You can put it in the cache for a very short duration anyway, just enough time for your frontend to request it.
  • g

    ghostfacedlover

    05/27/2023, 11:41 AM
    Any update on this? I need a new headless cms, right now it's sitting between Payload, Twill, Sanity and to a lesser extent webiny. Would love to see your teams approach to Headless. Twill in my opinion is the most polished in terms of what I deem critical features with Sanity second, but again any insights would be appreciated. Thanks.