Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea]: New plugin for all route-related stuff #890

Open
4 tasks done
hirasso opened this issue Apr 13, 2024 · 1 comment
Open
4 tasks done

[Idea]: New plugin for all route-related stuff #890

hirasso opened this issue Apr 13, 2024 · 1 comment

Comments

@hirasso
Copy link
Member

hirasso commented Apr 13, 2024

Describe the problem 馃

Currently, we have three core plugins that are related to modifying the visit object based on routes. In order of complexity:

I see two issues with this situation:

  • tedious setup for end users
  • need for test duplication between the plugins

The two PROs I see:

  • bigger control over the bundle size for consumers.
  • each plugin's task is clear and therefor easier to contribute to

Describe the propsed solution 馃槑

Merge the three plugins into one: @swup/routes-plugin

import Swup from "swup";
import SwupRoutesPlugin from "@swup/routes-plugin";

new Swup({
  plugins: [
    new SwupRoutesPlugin({
      routes: [
        {
          from: "(.*)",
          to: "(.*)",
          //... containers, name, scroll, focus, animations, ...
        }
      ]
    })
  ]
});

Alternatives considered 馃

Leave it as it is.

How important is this feature to you? 馃Л

Nice to have

Checked all these? 馃摎

@hirasso hirasso changed the title [Idea]: New Plugin (or module?) for any route-related stuff [Idea]: New plugin for all route-related stuff Apr 13, 2024
@daun
Copy link
Member

daun commented Apr 13, 2024

Interesting! I haven't yet used all three of them together, but I agree the overlap in routing functionality is a bit unfortunate. I'm not sure collapsing them into a single plugin would make it easier to explain this plugin to users (it now does animations + urls + dom fragments), but I'd love to explore this on a call sometimes and see where it takes us 馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants