@magnolia/cli-create-virtual-uri-plugin
v1.0.0
Published
A plugin for Magnolia CLI to create a virtual URI mapping in a light module
Downloads
33
Readme
CreateVirtualUriPlugin
A plugin for Magnolia CLI to create a virtual URI mapping in a light module
Installation
Using add-plugin
Run the following command in the project's root directory:
npm run mgnl -- add-plugin @magnolia/cli-create-virtual-uri-plugin
The command will install the plugin, and automatically register the plugin in
mgnl.config.js
file:import CreateVirtualUriPlugin from "@magnolia/cli-create-virtual-uri-plugin"; export default { plugins: [ new CreateVirtualUriPlugin() ] };
To confirm that the plugin has been successfully installed, run:
npm run mgnl -- create-virtual-uri --help
Manually
- Run the following command in the project's root directory:
npm install @magnolia/cli-create-virtual-uri-plugin
- Manually add CreateVirtualUriPlugin to mgnl.config.js file:
import CreateVirtualUriPlugin from "@magnolia/cli-create-virtual-uri-plugin"; export default { plugins: [ new CreateVirtualUriPlugin() ] };
- To confirm that the plugin has been successfully installed, run:
npm run mgnl -- create-virtual-uri --help
Usage
Options
| Short | Long | Description |
|-------------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| -f <uri>
| --from <uri>
| set the pattern to match in the requested URI; defaults to an empty string |
| -t <prefix:uri>
| --to <prefix:uri>
| map the request to a concrete URI; following action prefixes are supported: 'redirect:', 'permanent:' and 'forward:'; defaults to an empty string |
| -lm [name]
| --light-module [name]
| set the light module for the virtual URI mapping; defaults to the directory specified in mgnl.config.js file |
| -pd <path>
| --prototype-dir <path>
| use the specified path to the custom prototype templates directory as the prototype source for virtual URI mapping creation |
| -p [name]
| --prototype [name]
| select a prototype for virtual-uri creation |
| -v
| --version
| output the version number |
| -h
| --help
| display help for command |
Examples
Create virtual URI
npm run mgnl -- create-virtual-uri "myFooMapping"
This commands creates a new virtual URI file called "myFooMapping" based on "_default" prototype.
If neither the lightModulesPath
nor the lightModule
property exists in mgnl.config.js, the plugin will prompt you to choose each.
Create virtual URI with defined "fromUri" parameter
npm run mgnl -- create-virtual-uri "myFooMapping" --from "/foo"
This commands creates a new virtual URI file called "myFooMapping" based on "_default" prototype, with fromUri
set to /foo
.
If neither the lightModulesPath
nor the lightModule
property exists in mgnl.config.js, the plugin will prompt you to choose each.
Create virtual URI with defined "toUri" and "fromUri" parameters
npm run mgnl -- create-virtual-uri "myFooMapping" --from "/foo" --to "forward:/bar"
This commands creates a new virtual URI file called "myFooMapping" based on "_default" prototype, with fromUri
set to /foo
and toUri
set to forward:/bar
.
If neither the lightModulesPath
nor the lightModule
property exists in mgnl.config.js, the plugin will prompt you to choose each.
Plugin Documentation
For detailed documentation of the plugin, please refer to Plugin Documentation
Magnolia CMS
This plugin is created to work with Magnolia CMS. For more information, please refer to Magnolia CMS Documentation