drupal-radix-cli
v1.0.8
Published
CLI for managing Radix components in a Drupal theme
Maintainers
Readme
Radix Drupal CLI
Radix Drupal CLI is an interactive prompt designed to manage Drupal Radix 6 components. It allows for easy listing, adding and generating of components to your Drupal theme, leveraging the power of the Radix base theme components.
Note: that this CLI uses your own local Radix theme as a source for components. If you want to add components from the latest version of Radix, you must first update your local Radix theme.
Features
- List Components: Display all available Radix components.
- Add Components: Add Radix components to your theme, automatically replacing any existing ones. Includes automatic template reference updates.
- Generate Components: Generate a new component folder with all the necessary files.
- Template Reference Updates: Automatically update
radix:COMPONENTNAMEreferences toTHEMENAME:COMPONENTNAMEin your template files when adding components.
Installation
Ensure you have Node.js and npm installed on your system. Install the CLI tool within your subtheme or globally via npm:
npm install drupal-radix-cliNote: You may also install the package globally: npm install -g drupal-radix-cli
Usage
Once installed, you can use the CLI tool with the following commands:
List Components
To list all Radix components available in the default directory:
drupal-radix-cli listAdd Components
To add a Radix component to your current theme:
drupal-radix-cli addUse the --radix-path flag to specify a custom Radix components directory if your Radix base theme is installed in a non-standard location:
drupal-radix-cli add --radix-path ../../radix/componentsUse the --no-template flag to skip automatic template reference updates when adding components:
drupal-radix-cli add --no-templateBy default, when adding a component, the CLI will automatically scan your /templates directory for *.html.twig files and replace any radix:COMPONENTNAME references with THEMENAME:COMPONENTNAME. Use the --no-template flag if you prefer to update these references manually.
Generate Components
To generate a clean new component folder within your subtheme components directory:
drupal-radix-cli generateThis will generate a new component folder with the following files:
[component-name]/[component-name].twig[component-name]/[component-name].component.yml[component-name]/[component-name].scss[component-name]/_[component-name].js[component-name]/README.mdx
Make sure to remove any unwanted files and update your files accordingly.
Help
Display usage instructions:
drupal-radix-cli --helpOr simply drupal-radix-cli.
Radix Theme
The Radix theme is a component-base theme for Drupal. For more information, visit the Radix theme project page on Drupal.org.
Contributing
Contributions are welcome! Submit pull requests or create issues for any enhancements, bugs, or features.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
