ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sass​Beautify

by badsyntax ST2/ST3

A Sublime Text plugin that beautifies Sass files.

Labels sass, formatting

Details

Installs

  • Total 85K
  • Win 36K
  • OS X 38K
  • Linux 11K
Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12
Windows 6 23 46 44 51 55 50 21 29 31 57 54 57 40 25 36 39 51 50 45 46 16 30 29 43 56 40 33 19 17 30 37 26 55 36 20 15 36 35 41 49 58 30 22 44 40
OS X 7 17 31 33 57 32 30 16 9 35 41 34 37 33 16 15 41 41 41 31 27 18 13 30 28 25 33 27 17 11 27 28 39 28 24 14 21 21 29 35 35 34 14 16 27 34
Linux 1 8 17 15 11 9 9 8 11 12 12 9 13 13 8 7 9 8 9 7 14 7 2 14 11 10 17 11 8 4 7 9 17 7 7 12 7 13 9 10 16 7 8 11 12 7

Readme

Source
raw.​githubusercontent.​com

SassBeautify

https://sublime.wbond.net/packages/SassBeautify

A Sublime Text plugin that beautifies Sass files. (Compatible with Sublime Text 2 & 3.)

ScreenShot

Dependencies

This plugin uses sass-convert, and so you need to have sass installed. Read the sass download page to view the installation options.

It's a good idea to always use the latest version of Sass.

Installation

Option 1 (recommended)

Install via package control:

  1. Ensure you have package control installed, see here: https://sublime.wbond.net/installation
  2. Install the package: open up the command palette (ctrl/cmd + shift + p), execute the following command: 'Package Control: Install Package', then enter 'SassBeautify'

Option 2

Manual download:

  1. Download the zip file file here: https://github.com/badsyntax/SassBeautify/archive/master.zip
  2. Unzip the archive, rename the 'SassBeautify-master' folder to 'SassBeautify' and move it into your Sublime Text 'Packages' directory.

Usage

Default usage

Run the plugin from the command palette:

  1. Open the command palette (ctrl/cmd + shift + p)
  2. Enter 'SassBeautify'

Conversion usage

Run the conversion commands from the command palette:

  1. Open the command palette (ctrl/cmd + shift + p)
  2. Type 'SassBeautify'
  3. Choose one of the following options:
    • Convert from CSS to current type
    • Convert from SCSS to current type
    • Convert from SASS to current type

Settings

Once installed, you can customize how the beautification works by changing the package settings.

  1. Open the default settings from the preferences menu: Preferences >> Package Settings >> SassBeautify >> Settings - Default
  2. Copy the settings and paste them into your user settings file: Preferences >> Package Settings >> SassBeautify >> Settings - User
  3. Change the user settings.

Settings overview

The following settings can be adjusted:

{
  // How many spaces to use for each level of indentation. "t" means use hard tabs.
  "indent": 4,
  // Convert underscores to dashes.
  "dasherize": false,
  // Output the old-style ":prop val" property syntax. Only meaningful when generating Sass.
  "old": false,
  // Custom environment PATH.
  "path": false,
  // Custom environment GEM_PATH.
  "gemPath": false,
  // Beautify the sass file after saving it?
  "beautifyOnSave": false,
  // Keep "inline" comments inline?
  "inlineComments": false,
  // Add a new line between selectors?
  "newlineBetweenSelectors": false,
  // Use single quotes everywhere
  "useSingleQuotes": false
}

Key bindings

The plugin does not set any default key bindings, thus you will need to specify your own.

In your keymap file (Preferences >> Key bindings - User), add a custom key binding:

[
    {
        "keys": ["alt+w"],
        "command": "sass_beautify"
    }
]

Issues with ruby, Sass and your PATH

If you installed ruby and sass via a version manager tool like RVM, rbenv or via an installer like ruby installer, then you're likely to encounter issues with running sass-convert from Sublime Text.

Compatibility with RVM/rbenv

You need to specify the custom PATH and GEM_PATHvalues in your SassBeautify user settings.

Follow the steps below:

  1. Open up terminal
  2. Run: echo $PATH
  3. Copy the entire PATH into the 'path' setting
  4. Run: echo $GEM_PATH
  5. Copy the entire GEM_PATH into the 'gemPath' setting

Compatibility with RubyInstaller

During the install process, there should be an option to add ruby to your environment PATH. Ensure this option is selected.

Issues

This plugin should work on Linux (tested on Ubuntu 12.04), Windows (tested on Windows 7/8) and OSX (tested on 10.5.7).

Please create an issue if you find it doesn't work as expected on your setup.

Thanks

Thanks to the contributors and to all the people who have tested and reported issues.

License

Licensed under the MIT license. Created by Richard Willis