Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:
npm run mgnl "--" ...Copy
This command creates a new block called my-block based on the _default prototype.
The plugin will prompt you to:
Choose a directory containing all light modules.
Choose a light module directory where the new block will be created.
The plugin writes the following properties to the mgnl.config.js file:
Global
lightModulesPath
Plugin
lightModule
Create a new block in a specific light module
npm run mgnl -- create-block "my-block" --light-module "my-lm"Copy
Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:
npm run mgnl "--" ...Copy
The command creates a new block called my-block based on the _default prototype in the my-lm light module.
The plugin prompts you to choose a directory containing all light modules.
If the my-lm light module doesn’t exist in the light modules directory, the plugin prompts you to select another one.
The plugin writes the following properties to the mgnl.config.js file:
Global
lightModulesPath
Plugin
lightModule
Create a new block based on a prototype from a custom prototypes directory
npm run mgnl -- create-block "my-block" --prototype-dir "/path/to/custom-prototypes-dir/block"Copy
Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:
npm run mgnl "--" ...Copy
This command creates a new block called my-block based on the _default prototype from /path/to/custom-prototypes-dir/block.
The plugin will prompt you to:
Choose a directory containing all light modules.
Choose a light module directory where the new block will be created.
If the _default prototype is not present in the custom prototypes directory, it prompts you to choose another prototype.
The plugin writes the following properties to the mgnl.config.js file:
Global
lightModulesPath
Plugin
lightModule
prototypeDir
prototype
The structure of the custom prototypes directory can be:
npm run mgnl -- create-block "my-block" --prototype-dir "/path/to/custom-prototypes-dir/block" --prototype "my-second-prototype"Copy
Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:
npm run mgnl "--" ...Copy
Create a new block based on a specific prototype
npm run mgnl -- create-block "my-block" --prototype "empty"Copy
Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:
npm run mgnl "--" ...Copy
The command creates a new block called my-block based on the empty prototype.
The plugin will prompt you to:
Choose a directory containing all light modules.
Choose a light module directory where the new block will be created.
The Create Block plugin contains the _default and "empty" prototypes.
To choose a custom prototype from a custom prototypes directory, use the --prototype with --prototype-dir option.
The plugin writes the following properties to the mgnl.config.js file:
Global
lightModulesPath
Plugin
lightModule
prototype
Configuration
You can set the following properties in mgnl.config.js to predefine the plugin’s behavior.
Global properties
Property name
Description
lightModulesPath
The path to a directory containing all light modules.
lightModule
The name of a light module where the block will be created.
Alternative forms: -lm [name], --light-module [name]
Plugin properties
Property name
Description
lightModule
The name of a light module where the block will be created.
Alternative forms: -lm [name], --light-module [name]
prototypeDir
The path to a custom prototypes directory.
Alternative forms: -pd <path>, --prototype-dir <path>