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.

Layers/Extends Support Tracker

See original GitHub issue

Nuxt layers are a powerful feature that you can use to share and reuse partial Nuxt applications within a monorepo, or from a git repository or npm package.

Docs:

This issue is used to track the progress of enhancements and known issues in the roadmap.

Features:

Bugs:

  • Auto imports for nitro layers (#9384)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:54
  • Comments:26 (15 by maintainers)

github_iconTop GitHub Comments

10reactions
Tahulcommented, Mar 24, 2022

Hey there 👋

We’ve made a review of extends feature with @kevinmarrec so I can document it!

I would like to brainstorm few ideas with you, before beginning any changes.

Aside from these points, we’ve tried the extends feature together with @kevinmarrec and it went really well!

I will start creating a PR to document this with appropriate examples as you mentioned in the first message. 🙂

Extends configuration

With the current extends implementation, once you pass a path to be extended, Nuxt will try to grab every available feature from this extended directory.

It is really great to have such behavior as it makes extends a real plug & play feature, but having some flexibility over how we do extend our project would be really great.

What I suggest is to have a similar way to configure your extends as components does:

defineNuxtConfig({
   extends: [
      './base', // Would be fully extended
      {
            path: './ui',
            middleware: false, // Would skip middleware extending
            pages: false, // Would skip pages extending
            // All of the rest are set to `true` by default
        }
   ]
})

That would maybe include a PR to c12 package in order to support this.

Extends pages prefixing

One cool feature would be to be able to rewrite the base path of pages from an extend target.

Let’s say you extend your project from a blog theme that has default pages exposed.

The blog theme might expose index pages and such from the root of its pages directory, so that would be overwritten by your own website.

What you might want then is to have these blog pages nested under a /blog prefix in your project.

We could use the previous configuration object to specify this:

defineNuxtConfig({
   extends: [
        './base', // Pages would be merged with project-level pages
        {
            path: './blog',
            pagesPrefix: '/blog' // Pages would be nested under `/blog` route prefix
        }
   ]
})

Low to high instead of high to low priority management

One thing we noticed during the review of extends is that currently the priority is handled in a high to low manner:

defineNuxtConfig({
   extends: [
        './ui', // This will override `./base`
        './base'
   ]
})

This is nitpicking but I think this is an opposite pattern of what we commonly expect from extends features.

For instance files like .eslintrc has this “last has highest precedence” as convention.

WDYT @danielroe @pi0 @Atinux @kevinmarrec ? 😄

4reactions
fanckushcommented, May 13, 2022

@pi0 will /assets also be supported?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlling Charge Transfer from Quantum Dots to ...
Controlling Charge Transfer from Quantum Dots to Polyelectrolyte Layers Extends Prospective Applications of Magneto-Optical Microcapsules.
Read more >
تويتر \ Sébastien Chopin (Atinux@) - Twitter
Layers/Extends Support Tracker · Issue #3222 · nuxt/framework. Nuxt layers are a powerful feature that you can use to share and reuse partial...
Read more >
CMS Conference Report - CERN Document Server
The CMS experiment relies on a Silicon pixel and micro-strip tracker for the reconstruction of tracks and vertices.
Read more >
Controlling Charge Transfer from Quantum Dots to ... - Figshare
... Dots to Polyelectrolyte Layers Extends Prospective Applications of ... which hampers their tracking and quantitative analysis in cells ...
Read more >
CMS HCAL installation and commissioning - IOPscience
The inclusion of the HO layers extends the total ... subsystems (HCAL, Muon, ECAL, Tracker) into a fully integrated detector (Fig. 3).
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