Package Exports
- @shufo/tailwindcss-class-sorter
- @shufo/tailwindcss-class-sorter/dist/main.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shufo/tailwindcss-class-sorter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tailwindcss-class-sorter
A tailwindcss class sorter that respects tailwind config file.
Installation
$ npm install @shufo/tailwindcss-class-sorter
# yarn
$ yarn add @shufo/tailwindcss-class-sorterUsage
const { sortClasses } = require("@shufo/tailwindcss-class-sorter");
const sorted = sortClasses("pt-2 p-4");
console.log(sorted);
// => "p-4 pt-2"tailwindcss-class-sorter will automatically look for tailwind.config.js in the project directory.
Then if it exists, it will sort according to the tailwindcss configuration. If it does not exist, the default sort order of tailwindcss plugin will be used.
API
functions
sortClasses(classes: string, options: IOption)
classes: classes string e.g. z-5 z-50
Interfaces
IOption
export interface IOption {
tailwindConfigPath?: string;
tailwindConfig?: TailwindConfig;
}| key | value |
|---|---|
| tailwindConfigPath | A path to tailwind config file |
| tailwindConfig | A configuration object of tailwind config |
Testing
$ yarn install
$ yarn run testBenchmarking
$ yarn run benchmark
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
LICENSE
MIT