Created
April 6, 2012 13:26
-
-
Save EtienneLem/2319775 to your computer and use it in GitHub Desktop.
Compile Stylus to CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>beforeRunningCommand</key> | |
<string>saveActiveFile</string> | |
<key>command</key> | |
<string>#!/usr/bin/env ruby | |
# encoding: utf-8 | |
in_inclusion = ENV['TM_FILEPATH'].match(/_(.)+\.styl/) | |
in_assets_folder = ENV['TM_FILEPATH'].match(/assets\//) | |
# Automagically compile .styl to .css if: | |
# · Not in `assets/` folder | |
# · Filname is not `_*.styl` | |
if !in_inclusion && !in_assets_folder | |
result = `stylus #{ENV['TM_FILEPATH']}` | |
error = /throw\ err/.match(result) | |
if error == nil | |
puts "✓ compiled #{ENV['TM_FILEPATH'].sub(/\.(styl|stylus)$/, '.css')}" | |
else | |
puts "✗ #{result}" | |
end | |
end</string> | |
<key>input</key> | |
<string>none</string> | |
<key>keyEquivalent</key> | |
<string>@s</string> | |
<key>name</key> | |
<string>Compile Stylus to CSS</string> | |
<key>output</key> | |
<string>showAsTooltip</string> | |
<key>scope</key> | |
<string>source.stylus</string> | |
<key>uuid</key> | |
<string>5538C418-2C8C-410E-A15F-7EFB29EA8F7D</string> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CMD + S when editing
styles.styl
/assets
folder (see connect-assets)_utils.styl
)styles.css
besidestyles.styl