sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7.01k stars 434 forks source link

Defining custom directories for application routes. #836

Closed robertpiosik closed 5 years ago

robertpiosik commented 5 years ago

👋

Is your feature request related to a problem? Please describe. You can't build multiple frontends which are reusing the same base (repo wide) components.

Describe the solution you'd like Following nuxtjs approach we could have an option to change the location where compiler is looking for routes. Folder name is then set up dynamically thanks to environment variables.

Describe alternatives you've considered Changing /src/routes directory name manually. (Really not considered in practice, rather as silly alternative thinking about quick alternative)

How important is this feature to you? I'm deploying apps in multiple languages, every language has it's own backend and reuse different components. Think about languages which are minor for company where elements which are expensive for keeping up to date are omitted (such as blog/news).

Additional context Proposed folder structure where routes path is changed from /src/routes to /src/apps/en and /src/apps/fr by environment variables which are set in netlify/awsamplify/zeit/render/whatever for automatic static deployments and changed manually in .env during development.

src 
    components
        AboutUs.svelte
        RecentBlogPosts.svelte
    apps
        en
            index.svelte (contains AboutUs and RecentBlogPosts components)
        fr
            index.svelte (contains AboutUs component only)
robertpiosik commented 5 years ago

Nevermind, it's already possible.

Run ./node_modules/sapper/sapper dev --help and use --routes flag.