Skip to main content

CSS Property Sorter Script

Project description

# CSS Property Sorter Script

## Installation

pip install

### Setup for Vim

1. Create `~/.vim/ftplugin/css.vim` if it's not existed yet.
2. Open `~/.vim/ftplugin/css.vim` and add new lines below:

" CSS Property Sorter Script (:SortCSS to run)
command! -range=% -nargs=* SortCSS :<line1>,<line2>!python /path/to/ <f-args>

## Usage

### Command-line options

usage: [-h] [-g] [--css-props-file [CSS_PROPS_FILE]]

positional arguments:
INFILE Input file
OUTFILE Output file

optional arguments:
-h, --help show this help message and exit
-g, --group group properties
--css-props-file [CSS_PROPS_FILE]
use custom CSS properties list file

#### CSS properties list file

You can use custom list by supplying the file to ``, the basic format is:

# comment


The order of properties is the order that`` sort by and the blank line also indicates separate groups. If you have `-g`, then `` will insert a blank line between the groups.

### Usage in Vim

1. Open a CSS file in Vim.
2. Turn in to Visual mode.
3. Select CSS definition(s). At least 1 set of `{` to `}`.
4. Type `:SortCSS` and return.

This will automatically sort your CSS properties.

#### Notes

* You can just type `:SortCSS` so that entire properties will be sorted in a file.
* You can also append arguments as if using `` directly, e.g. `:SortCSS -g` for grouping.

## Credits

You can find more information about the script below:

This script is based on Kyo Nagashima's Perl script:

* Yu-Jie Lin,
* Yu I., Twitter @japboy
* Kyo Nagashima <>,
* xaicron,

## License

MIT License, see COPYING

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (7.6 kB) Copy SHA256 hash SHA256 Source None (7.9 kB) Copy SHA256 hash SHA256 Source None (14.2 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page