Styled Components Sorting Extension for VS Code
Sorts styled components in a file.
- Sorts by Alphabetical order
- Sorts by Mozilla's Ordering CSS Properties(Coming Soon)
- Sorts by Naver's Ordering CSS Properties(Coming Soon)
This extension provides the functionality to automatically sort style elements in styled-components. You can instantly organize style elements in alphabetical order by using the following key bindings while focusing on text in the editor:
- Mac:
Cmd + Shift + S - Windows/Linux:
Ctrl + Shift + S
Using these key bindings will sort all styled-components style definitions in the currently active file. This helps in enhancing the consistency and readability of your code.
How to Use
- Open a file that contains styled-components style definitions.
- Ensure the file is active in the editor.
- Press
Cmd + Shift + S(on Mac) orCtrl + Shift + S(on Windows/Linux) to sort the style elements. - Review the sorted style elements.
This feature operates on JavaScript and TypeScript files using styled-components.
This extension contributes to the VS Code settings, allowing you to customize its behavior according to your preferences. You can find these settings by going to Code > Preferences > Settings and searching for the extension's name.
The following settings are provided by this extension:
styledComponentsSorting.enable: Enable or disable the styled components sorting feature. Set to true to enable and false to disable.styledComponentsSorting.sortOnSave: Automatically sort styled components when the file is saved. Set to true to enable auto-sorting on save.styledComponentsSorting.sortOrder: Define the order in which the styled components should be sorted. Options includealphabetical, grouped, etc. To modify these settings, you can add them to your workspace or user settings JSON file. For example:
{
"styledComponentsSorting.enable": true,
"styledComponentsSorting.sortOnSave": false,
"styledComponentsSorting.sortOrder": "alphabetical"
}These settings allow you to tailor the extension's functionality to better suit your workflow.
Plz mail to me if you have any issues.
mail: [email protected]
Initial release of styled-components-sorting
Change Extension Icon
- Update README.md
- Add Extension Default Keybindings
- Add feature to add leading and trailing spaces for formatting when sorting
Enjoy