-
Notifications
You must be signed in to change notification settings - Fork 87
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Base path #85
Comments
This is something we've discussed internally and it's definitely something we want, even if it's not a high priority at the moment. |
I looked a bit on the code and I might get it wrong, but isn't it essentially about adding base to each route in template generator? |
There are tests, (but you'd have to ask @rixo about those), SSR, prerendering and helpers. I wonder if something like It's a bit hacky, but might work. |
Been pondering this issue and I wonder if we can add anything that couldn't be accomplished by adjusting the file structure to Pros
Cons
Alternatively we'd have to add an options for a custom path, but it would take some wiring to make it work with prerendering and ssr. |
Hey, did not try routify yet but it would be cool if routify support IPFS website that can be accessed from different path at the same time Indeed, with IPFS a website can be accessed from a gateway via hash (with an ipfs/ prefix, like https://gateway.ipfs.io/ipfs/QmNVTWGZ4qoW4DwiTze3icNJKhKBArR4HrCR1sapAFaPYg/ I made a PR on sapper that support it : sveltejs/sapper#866 It uses base path plus it ensure slash terminated path are supported so that it works on IPFS |
I personally uses routify in my SPA app. I done changes to match this feature. but without SSR. you can find it here: https://github.com/sup-ham/routify/tree/base-url Here the usage BASE_URL=/base SPA_ENTRY=__app.html npm run [ dev | build ] the routify-starter's rollup.config.js needed to updated for replacing string {BASE_URL} in template. Copying template part plugins: [
copy({
targets: [
{ src: staticDir + '/argon', dest: distDir },
{
src: template,
dest: distDir,
rename: process.env.SPA_ENTRY ||'index.html',
transform: (content) => content.toString().replace(/\{BASE_URL}/g, process.env.BASE_URL || ''),
},
], copyOnce: true
}), function serve() at bottom function serve() {
let started = false;
return {
writeBundle() {
if (!started) {
started = true;
require('child_process').spawn('npm', ['run', 'start', '--', '--dev', process.env.SPA_ENTRY ||''], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
}
}
};
} |
Looks very interesting. |
There's experimental basepaths in the beta build, but it might be replaced in favor of an URL transform function. |
For example for testing your web you might use git[la|hu]b/pages. And it will have repo name as a part of path in the address. Need configuration feature to specify base path.
Otherwise getting:
Uncaught Error: Route could not be found. Make sure /front-old/.svelte or /front-old//index.svelte exists. A restart may be required.
The text was updated successfully, but these errors were encountered: