compiler: resolve paths in middleware params#74
Conversation
Introduce a convention for specifying relative paths in middleware
params: values prefixed with `$!` and starting with `./` or `../`
are resolved relatively to `middleware.json`.
Example:
{
"files": {
"loopback#static": {
"params": "$!../client"
},
"loopback#static": {
"params": "$!./public"
}
}
}
|
Maybe it requires a name eg. |
I expect this feature will be used quite frequently, therefore I prefer to keep the prefix as short as possible. Also note that the path is relative to the |
|
I'm leaning toward to use typical variable delimiters for JS templates. For example, It will allow us to use existing template engines to parse the templates and inject values. I'm fine to have a shortcut for this special case with a prefix such as '#!' (why not use #!?). |
|
That may be a good solution for #75 👍 |
|
I'm fine to use |
…leware-params compiler: resolve paths in middleware params
Introduce a convention for specifying relative paths in middleware params: values prefixed with
$!and starting with./or../are resolved relatively tomiddleware.json.Example (
server/middleware.json)/to @ritch @raymondfeng please review, especially whether the prefix value makes sense to you too. It was inspired by hashbang (
#!) used by client-side MVC frameworks.I have discovered this use case while reworking the template scaffolded by
slc loopbackas part of strongloop/loopback-workspace#167