<h1 align="center">Astro Dev-only Routes π</h1> <h4 align="center">Make some routes only available in dev mode</h4>
npm install astro-dev-only-routesastro-dev-only-routes?astro-dev-only-routes?astro-dev-only-routes is an Astro integration that allows you to make some routes only available in dev mode.
Many Thanks to all the Stargazers


To get started, you can install astro-dev-only-routes with the astro add CLI tool
``shUsing NPM
npx astro add astro-dev-only-routes
Now that you have installed the integration, you can add dev-only routes by prefixing the route with double underscores (
__).Create a new file in the
src/pages directory and name it __secret-panel.astro. This page will only be available in dev mode.
`astro
// src/pages/__secret-panel.astro
---
console.log('This page is only available in dev mode.')
---Secret Page
This page is only available in dev mode.
`That's it! Now you can run
astro dev and navigate to http://localhost:3000/__secret-page to see the page.
Try running astro build and you will see that the page is not included in the build.π Known Issues
- index.astro routes need to be reference with the index part instead of just /. It's technically possible to fix that but there's a bug in Astro that maskes the fix cause those routes to collide with the root index.astro route, even though that's not the case. Gonna open an issue for that.πΊοΈ Roadmap
This is what's planned for the future. If you have any suggestions, please open an issue.
- [ ] Create a proposal for Astro to add this feature natively.π‘οΈ License
This project is licensed under the MIT License - see the LICENSE` file for details.If you liked this project, please give it a βοΈ. That's the best way you can support it!