Motivation

Provide a plugin making use https://github.com/drunomics/nuxt-component-preview

Proposed resolution

- Make it some global markup for having one global nuxt app, automatically, once page page - but only when needed
- Re-use the same nuxt-app for multiple components

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review

This PR is ready to review, testing it atm together with #3546449: Add a generic JavaScriptComponentSource

fago’s picture

Testing it with a custom service like this:

parameters:
  custom_elements.nuxt_preview.base_url: 'http://10.0.1.161:3000'
services:
  custom_elements.preview_provider.nuxt:
    class: Drupal\custom_elements\Plugin\CustomElementsPreviewProvider\NuxtPreviewProvider
    factory: ['@plugin.manager.custom_elements_preview_provider', 'createInstance']
    arguments: ['nuxt']
    calls:
      - [setBaseUrl, ['%custom_elements.nuxt_preview.base_url%']]
    tags:
      - { name: custom_elements.preview_provider, priority: 100 }

useernamee’s picture

#3542938: Add API to preview custom elements in Drupal makes more sense when you see the nuxt preview provider service definition. I propose reviewing this after we merge parent ticket.

fago’s picture

right! It landed, thus I update the MR

fago’s picture

This has a green build + it works together with github.com/drunomics/nuxt-component-preview fine!

fago’s picture

oh, before I forget, the AI disclosure: I used AI to help me developing this!

fago’s picture

Title: Add a Nuxt preview-provider » Add a Nuxt preview-provider using the nuxt-component-preview module

  • fago committed d39682cb on 3.x
    [#3548197] feat: Add a Nuxt preview-provider using the nuxt-component-...
fago’s picture

Status: Needs review » Fixed

ok, merged it, so we can move on more easily and have green tests again. Let's open new issues for all remarks found.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.