podium-lib / issues

All podium issues, bugs, questions etc goes here. Documentation is to be found at https://podium-lib.io
1 stars 0 forks source link

Change prefix argument to default be true #27

Closed trygve-lie closed 4 years ago

trygve-lie commented 5 years ago

This task touches a behavior which is related to the pre-open source where the default way of making podlets was to write express.js routers which was bundled together into an application.

Due to this being the default at that time the pathname one set on the constructors in @podium/podlet and @podium/layout are not by default prepended to the path one set for content, manifest, fallback and the js and css routes. To prepended the pathname to these routes one need to set prefix as true when one are using one of the methods to get these values.

In other words, this returns /content when the .content() method is called:

const podlet = new Podlet({
    pathname : '/foo',
    content: '/content',
});

podlet.content();

This on the other hand returns /foo/content when the .content() method is called:

const podlet = new Podlet({
    pathname : '/foo',
    content: '/content',
});

podlet.content({ prefix: true });

Now as Podium is HTTP framework free and we do not encourage using Express Routers to bundle up Podlets into an application, having pathname not being prepended to the different paths is not intuitive and confusing. We should change the behavior so prefix is default trueinstead of false.