@elderjs/plugin-random
v1.8.0-beta.7
Published
Easily preview a random page of a route by visiting a single url. This plugin should be used exclusively for development.
Downloads
64
Maintainers
Readme
Elder.js Plugin: Random
Easily preview a random page of a route by visiting a single url. This plugin should be used exclusively for development.
What This Plugin Does:
When not running in process.env.NODE_ENV === 'production'
this plugin does 2 things:
- It creates a
/random/
route that lists each of your routes linking to/random/routeName/
. - It intercepts requests to
/random/routeName/
and randomly serves a page for that route.
Benefits:
Say that you have a route named blog
that has 1000 entries. With this plugin you could visit /random/blog/
and randomly design against any blog page instead of just one as most designers would do.
This is a simplistic example, but when building major sites with 10,000s of pages you'll often encounter scenarios where pages of the same route differ dramatically based on business logic.
By using this plugin, you can design and debug against random pages of a route without having to change the URL.
At ElderGuide.com we've found this is especially useful when working on a unified design across a route that can vary dramatically.
Having found this useful, it has now become a core part of our development process across all projects.
Install
npm install --save @elderjs/plugin-random
Config
plugins: {
'@elderjs/plugin-random': {},
}
Notes:
- When using this plugin with the
@elderjs/plugin-browser-reload
remember that/random/routeName/
will generate a new page each refresh. This can be annoying when working on CSS issues or thing that require stateful experiences on the front end. - If you are looking for the REAL url of a page look within
request.permalink
inside yourLayout.svelte
orRouteName.svelte
files.