A plugin for creating React Components in Sublime Text 2 and 3.
This plugin adds a context menu to Sublime's side bar that makes it simple to create a React Component in a parent folder. Simply give the component a name and answer the prompts, then a folder is created inside the parent with:
parent/
|-- ComponentName/
|---- index.js
|---- style.less
The stylesheet extension can be chosen from .css, .less, .scss, or
.sass, and can optionally include *.module.* (for css-modules)
automatically.
The index.js file can be a Functional or Class component and will
contain some helpful skeleton code.
With Package Control:
- Run "Package Control: Install Package" command
- Find and install
React Create Componentplugin - Restart Sublime Text (if required)
Manually:
- Clone or download this git repo into your packages folder (click Browse Packages to open this folder)
- Restart Sublime Text (if required)
Whenever you need to create a new component, just right click on the base folder and select Create React Component. It will:
- Ask for a component type (select, then press
ENTER) - Ask for a stylesheet type (select, then press
ENTER) - Ask if you want CSS Modules enabled (select, then press
ENTER) - Ask for a component name (type, then press
ENTER) - Create a new folder for the component with the given name
6. Add an
index.jsfile with skeleton code - Add a stylesheet based on the given preferences
You can get the latest code, make suggestions or report bugs at https://github.com/acsands13/sublime-react-create-component/issues.
Based off Python Create Package by curaloucura.