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

Sass​Builder

by bnlucas ST2

Sublime Text SASS compiler based on source directory config file.

Details

  • 2017.01.28.22.07.00
  • github.​com
  • github.​com
  • 4 weeks ago
  • 1 hour ago
  • 4 years ago

Installs

  • Total 13K
  • Win 8K
  • OS X 5K
  • Linux 881
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 1 1 7 4 8 14 8 2 6 1 8 6 14 12 3 8 8 12 9 10 8 6 2 2 8 16 8 6 4 0 2 2 2 4 3 1 2 3 1 4 2 1 4 2 3 5
OS X 2 1 2 7 6 7 6 2 1 2 5 3 2 0 2 4 2 4 4 3 3 5 1 4 9 7 3 6 3 0 1 1 3 4 1 1 0 3 1 0 0 5 0 0 0 2
Linux 0 1 1 4 2 1 1 0 1 1 1 0 0 1 0 1 3 0 3 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 1 0 0 0 1

Readme

Source
raw.​githubusercontent.​com

Sass Builder

Sass Builder is a SASS compiler that reads a config file (.sassbuilder-config) stored in a sass/scss source folder. It is a JSON file that sets .css output folder and SASS flags [cache, style, debug, line numbers, line comments].

The plugin works on post save of a .sass/.scss file in Sublime Text.

UPDATED!

This has been resting on the side burner for quite some time and it has finally received the attention it needed! This has finally been updated to support Sublime Text 3 and it also works with Python 3.

There was an issue with the grep command being called if the system didn't have it available. This has been corrected to search for grep first and run a pure pythonic method if it's not found in the system's PATH.

I have a small method for this which.py that mimics the Linux command which.

The .sassbuilder-config has been changed to .sassbuilder-config.json to remove the error Sublime Text 3 generates. project_path has be added to this to allow for scanning in the entire project path when partials are saved.

  • Automatically runs on save.
  • Create .sassbuilder-config files with ease
    • Tools->Sass Builder Config
    • Ctrl+B + Ctrl+S keystroke
    • Right-click a folder or folders in the side bar.

The .sassbuilder-config file

{
    "project_path": "/project/path",
    "output_path": "/project/path/css",
    "options": {
        "cache":         true,
        "debug":         false,
        "line-comments": true,
        "line-numbers":  true,
        "style":         "nested"
    }
}

Install with Sublime Package Control

  1. Add this repo using “Package Control: Add Repository” https://github.com/bnlucas/SassBuilder
  2. You can then add this package using Package Control as usual. Find “Package Control: Add Package” and search for “Sass Builder”

Known Issues on Mac

For some users, you may receive this error:

b'/bin/sh: sass: command not found\n'

This is because:

'There is a breakage or removal of environment variable functionality in launchd.conf for users of OS X 10.10 (Yosemite) and above.'

-Source https://support.enthought.com/hc/en-us/articles/204469160-How-do-I-set-PYTHONPATH-and-other-environment-variables-for-Canopy-

You can either follow the instructions to add the path to your executable to your PYTHONPATH as detailed in the link above or follow these steps:

  1. Install the “PackageResourceViewer” package to sublime using Package Control, then open this plugin within sublime.
  2. Edit SassBuilder.py line 113 changing
sass = 'sass --update \'{0}\':\'{1}\' --stop-on-error --trace {2} ' \
               '--style {3}'

to

sass = '/usr/local/bin/sass --update \'{0}\':\'{1}\' --stop-on-error --trace {2} ' \
               '--style {3}'