question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set different preview layout for the builder

See original GitHub issue

Maybe there is a simple way to do this but something as simple as fractal.components.set('builder.preview', '@anotherpreview'); isn’t working.

Any other way to do this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iKaschcommented, Jun 6, 2018

Ok, i solved it.

// Set the preview layout
if (env == 'build') {
  fractal.components.set('default.preview', '@build');
  fractal.components.set('files.preview', '@build');
  console.log('We are using the following preview layout: ' + fractal.components._config.default.preview);
} else {
  fractal.components.set('default.preview', '@preview'); 
  fractal.components.set('files.preview', '@preview');
  console.log('We are using the following preview layout: ' + fractal.components._config.default.preview);
}

The important part is fractal.components.set('files.preview', '@build'); The Docs only mention default.preview but not files.preview. I’m not sure it this is a bug or if the Docs are wrong or if i misunderstood something completely but this works for now.

✌️

0reactions
mihkeleidastcommented, Aug 14, 2020

I investigated this a bit. Working as expected in my testing.

The files.preview setting is used to look up a default preview file for a directory - e.g. if you have a preview.hbs in your src/components/collection folder, that preview file is automatically used for components in that collection. So this issue seems to happen only with some specific file structure that I haven’t been able to replicate. Essentially if you have a preview template file in a collection directory, that preview is used instead of the default preview. If anyone running into this can provide a repository with this issue present, it would be great.

Either way, I’d like to know what the usecase is for using different preview templates serving/building and if maybe this would be better solved by conditional statements in a single preview template.

Closing this again, feel free to comment if any new info pops up and I can revisit this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Layout Builder: Single Templates - YouTube
In addition to index (archive) templates, Pro's Layout Builder allows you to create beautiful blog posts and more.
Read more >
Getting Started with Layout Builder in Drupal 9 - Specbee
Scroll to the bottom and click on Layout options and select “Use Layout Builder”, then click on Save.
Read more >
Build a UI with Layout Editor | Android Developers
Introduction to the Layout Editor · Change the preview appearance · Create a new layout · Use layout variants to optimize for different...
Read more >
Allow Layout Builder live previews to be toggled to ... - Drupal
Provide a toggle that replaces live preview with a helpful description of what the block represents. The setting for the toggle should persist ......
Read more >
Auto Layout Guide: Working with Constraints in Interface Builder
There are three main options for setting up Auto Layout constraints in Interface Builder: You can control-drag between views, you can use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found