Automate React Task is a VS Code extension that provides convenient commands to automate common tasks when working with React projects.
This command creates a new React component by generating a folder containing a .js file and a .module.css file. It simplifies and speeds up the component creation process.
To use this command:
- Open the Command Palette in VS Code (press
Ctrl+Shift+PorCmd+Shift+P). - Type "Create Component" and select it.
- Enter the desired file name when prompted.
- The extension will create a folder with the specified name in your workspace and generate the necessary files inside it.
This command converts HTML class attributes into CSS modules className objects. It helps in using CSS modules with React components.
To use this command:
- Open the file in the editor where you want to convert the class names.
- Ensure that the file is a
.jsx,.jsfor javascript, or.tsx,.tsfor typescript. - Open the Command Palette in VS Code (press
Ctrl+Shift+PorCmd+Shift+P). - Type "Convert Class into ClassName" and select it.
- The extension will convert the class names into CSS modules
classNameobjects.
Example:
Before conversion:
<div class="container">
<h1 class=title>Hello, world!</h1>
</div>
After conversion:
<div className={styles.container}>
<h1 className={styles.title}>Hello, world!</h1>
</div>
This command converts hyphen-separated class names in CSS files into underscore-separated class names. It is useful when working with CSS modules and wanting to convert class names to follow a specific convention.
To use this command:
- Open the file in the editor where you want to convert the class names.
- Ensure that the file is a stylesheet file (
.css,.scss, or.postcss). - Select the class names you want to convert.
- Open the Command Palette in VS Code (press
Ctrl+Shift+PorCmd+Shift+P). - Type "Convert Hyphen to Underscore" and select it.
- The extension will convert hyphen-separated class names into underscore-separated class names.
- React workspace.
- Added "Convert Class into ClassName" command to convert class names to CSS modules
classNameobjects. - Added "Convert Hyphen to Underscore" command to convert hyphen-separated class names in CSS files.
If you have any feedback, suggestions, or issues, please submit them here. Contributions are also welcome! Fork the repository and create a pull request with your changes.
Enjoy automating your React tasks with Automate React Task extension!