Skip to content

Instantly share code, notes, and snippets.

@leostaples
Last active December 18, 2015 17:49
Show Gist options
  • Save leostaples/5821731 to your computer and use it in GitHub Desktop.
Save leostaples/5821731 to your computer and use it in GitHub Desktop.
Sublime Text - run rake task on save

###Run rake sass:compile:news when you save a .scss file

#####1.) Install https://github.com/alexnj/SublimeOnSaveBuild using Package Control

#####2.) Configure SublimeOnSaveBuild for your desired filetypes

Preferences > Package Settings > SublimeOnSaveBuild > Settings - User

{
    "filename_filter": "\\.(scss)$",
    "build_on_save": 1
}

#####3.) Create a new build

Tools > Build System > New Build System

e.g. "sass"

{
    "cmd": ["rake sass:compile:news"],
    "working_dir": "/Users/<username>/responsive-news/",
    "shell": "true",
    "path" : "<echo your $PATH in terminal and paste here>"
}

#####4.) Set GEM_HOME in Sublime's environment settings

% cd /Users/<username>/Library/Application Support/Sublime Text 2/Packages/User 
% nano <any_filename>.py

set contents to:

import os
os.environ['GEM_HOME'] = '<path to your gems>'

e.g.

os.environ['GEM_HOME'] = '/Users/<username>/.gem/ruby/1.8.7'

(you can find this using gem env)

#####5.) Restart ST2 and enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment