Available via npm
yarn global add rustywind
or
npm install -g rustywind
or
Install from a github release:
curl -LSfs https://avencera.github.io/rustywind/install.sh | sh -s -- --git avencera/rustywind
or
Download a release directly from github: github.com/avencera/rustywind/releases
Run rustywind with a path to output updated file contents to the terminal:
rustywind .
If you want to reorganize all classes in place, and change the files run with the --write
flag
rustywind --write .
Run rustywind with a path and the --dry-run
to get a list of files that will be changed:
rustywind --dry-run .
Run rustywind on your STDIN:
echo "<FILE CONTENTS>" | rustywind --stdin
For more options run help
rustywind --help
Inspired by Ryan Heybourn's headwind vscode plugin. This is a CLI tool that will look through your project and sort all Tailwind CSS classes.
It will also delete any duplicate classes it finds.
When Ryan released his vscode extension some people expressed an interest in having a CLI version.
In addition, I've had an interest in learning rust. I usually learn by doing. I thought this would be the perfect opportunity to make a small useful tool while learning rust.
Keep in mind this is my first rust project. My code here is most likely going to be ugly and not idiomatic rust. If you are a rust expert you're help in making the code nicer and more idiomatic will be greatly appreciated.
Any and all feedback and criticism is very welcome. If im doing anything stupid please let me know.
Run on current directoryOrder all classes in all files in directory (except for gitignored ones)
Get a list of all files in current directory recursively.#1Ignore all files in .gitignore#1Get all contents from the list of files 1 by 1#2Run regex on all file contents and get all class names#3Figure out how to sort class names using sorter array#4Replace old class names with new list of class names#5Save file#6Release via NPM(available via npmnpm install rustywind -g
)
Add CLI parser#8Use CLI parser to choose directory or file to run on#8Add#8--write
option which will change the files, change default to printing results to the terminal
Add#10--allow-duplicates
to allow duplicate class nameAddc975d1--dry-run
option to print out all changes to console
Search and change files in parallel (parallel map?)#9
- Add custom sorter via CLI args
--customer-sorter=...
- Add custom regex via CLI args
--custom-regex=...
- Add ability to add custom sorter
- Derive sorter from evaluation generated CSS from tailwind config file
- Add ability to exclude folders, or files using regex pattern
- Add argument for only searching in certain file types