Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adversinc/meteor-smart-router
The Meteor FlowRouter helper which allows setting up routes with less boilerplate
https://github.com/adversinc/meteor-smart-router
flow-router meteorjs router
Last synced: 25 days ago
JSON representation
The Meteor FlowRouter helper which allows setting up routes with less boilerplate
- Host: GitHub
- URL: https://github.com/adversinc/meteor-smart-router
- Owner: adversinc
- License: mit
- Created: 2018-02-16T09:49:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-17T18:14:38.000Z (about 1 year ago)
- Last Synced: 2024-09-30T05:20:50.356Z (about 1 month ago)
- Topics: flow-router, meteorjs, router
- Language: TypeScript
- Homepage:
- Size: 96.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is a Meteor FlowRouter helper which allows setting up routes with less
boilerplate. Basically, the routes are being prepared as a set of
properties.Still much to do.
Should be called _before_ all other files to ensure that our
custom routes (e.g. signup) have a priority over useraccountsROUTE SETTINGS
-----* layout (optional) - the layout to use
* main - the template to use for main slot
* top - template to put in top slot of the layout
* left - template to put in left slot of the layoutROUTE INHERITANCE
-----Route can be marked as a child of another route, by using a "parent"
field. Currently this only affects a page title generation.DYNAMIC TEMPLATES
-----Route can load template dynamically, thus allowing other pages load
faster. This is being done using Meteor dynamic module loading.To have route template load dynamically, add the following function to route:
```
dynamicTemplate: () =>
{ return import("/imports/ui/pages/maintenance/code.js") },
```This makes template module dynamic, and its code will load only on actual
route request.Important: as of 1.5.2, Meteor requires to see
an IMPICIT module load directive "import('/import/...../code.js')"
in the code. Thus, "dynamicTemplate" have to stay a function with an
implicit code inside.PAGE BODY CLASSES
-----To allow styling individual pages, router automatically ads the class
named according to the page route, e.g.: page-index, page-new-messageThis class is being added on route render and removed just before the new
route is being rendered.Also, to (possibly) notify user about page loading, router adds
"routers-switching" class to the body while new route is loading.## Custom body classes
The custom body classes can be set for the specific route or the whole website.
Set route.bodyClass, defaultSet.bodyClass to string or array of strings.PAGE TITLE
-----Page title is being constructed using the following parts:
1. session.get("document.title")
2. current route "title" value
3. the value of the "parent" route (see ROUTE INHERITANCE)
4. the default titleThese values are being joined with " - ".
TODO
-----1. Add redirectIfLogged support (it is being used somewhere)