Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/aussiegeek/ruby-sass-tmbund…

…le into merge_aussie
  • Loading branch information...
commit b58f352f9c9e854522c7a30f359a011c266010a0 2 parents dce8568 + 75ba9a7
@choan choan authored
Showing with 161 additions and 7 deletions.
  1. +25 −0 Commands/Compile SASS.tmCommand
  2. +1 −1  Preferences/Symbol List: Selector.tmPreferences
  3. +4 −0 README
  4. 0  ...attachment position copy.tmSnippet → background color image repeat attachment position copy.tmSnippet}
  5. 0  Snippets/{:background-attachment scroll:fixed.tmSnippet → background-attachment scroll:fixed.tmSnippet}
  6. 0  Snippets/{:background-color hex.tmSnippet → background-color hex.tmSnippet}
  7. 0  Snippets/{:background-color name.tmSnippet → background-color name.tmSnippet}
  8. 0  Snippets/{:background-color rgb.tmSnippet → background-color rgb.tmSnippet}
  9. 0  Snippets/{:background-color transparent.tmSnippet → background-color transparent.tmSnippet}
  10. 0  Snippets/{:background-image none.tmSnippet → background-image none.tmSnippet}
  11. 0  Snippets/{:background-image url.tmSnippet → background-image url.tmSnippet}
  12. 0  Snippets/{:background-position position.tmSnippet → background-position position.tmSnippet}
  13. 0  Snippets/{:background-repeat r:r-x:r-y:n-r.tmSnippet → background-repeat rr-xr-yn-r.tmSnippet}
  14. 0  Snippets/{:border size style color copy.tmSnippet → border size style color copy.tmSnippet}
  15. 0  Snippets/{:border-bottom size style color copy.tmSnippet → border-bottom size style color copy.tmSnippet}
  16. 0  Snippets/{:border-bottom-color color.tmSnippet → border-bottom-color color.tmSnippet}
  17. 0  Snippets/{:border-bottom-style style.tmSnippet → border-bottom-style style.tmSnippet}
  18. 0  Snippets/{:border-bottom-width size copy.tmSnippet → border-bottom-width size copy.tmSnippet}
  19. 0  Snippets/{:border-color color copy.tmSnippet → border-color color copy.tmSnippet}
  20. 0  Snippets/{:border-left size style color.tmSnippet → border-left size style color.tmSnippet}
  21. 0  Snippets/{:border-left-color color.tmSnippet → border-left-color color.tmSnippet}
  22. 0  Snippets/{:border-left-style style.tmSnippet → border-left-style style.tmSnippet}
  23. 0  Snippets/{:border-left-width size.tmSnippet → border-left-width size.tmSnippet}
  24. 0  Snippets/{:border-right size style color.tmSnippet → border-right size style color.tmSnippet}
  25. 0  Snippets/{:border-right-color color.tmSnippet → border-right-color color.tmSnippet}
  26. 0  Snippets/{:border-right-style style.tmSnippet → border-right-style style.tmSnippet}
  27. 0  Snippets/{:border-right-width size.tmSnippet → border-right-width size.tmSnippet}
  28. 0  Snippets/{:border-style style copy.tmSnippet → border-style style copy.tmSnippet}
  29. 0  Snippets/{:border-top size style color.tmSnippet → border-top size style color.tmSnippet}
  30. 0  Snippets/{:border-top-color color.tmSnippet → border-top-color color.tmSnippet}
  31. 0  Snippets/{:border-top-style style.tmSnippet → border-top-style style.tmSnippet}
  32. 0  Snippets/{:border-top-width size.tmSnippet → border-top-width size.tmSnippet}
  33. 0  Snippets/{:border-width size copy.tmSnippet → border-width size copy.tmSnippet}
  34. 0  Snippets/{:clear value.tmSnippet → clear value.tmSnippet}
  35. 0  Snippets/{:color hex.tmSnippet → color hex.tmSnippet}
  36. 0  Snippets/{:color name.tmSnippet → color name.tmSnippet}
  37. 0  Snippets/{:color rgb.tmSnippet → color rgb.tmSnippet}
  38. 0  Snippets/{:cursor type.tmSnippet → cursor type.tmSnippet}
  39. 0  Snippets/{:cursor url.tmSnippet → cursor url.tmSnippet}
  40. 0  Snippets/{:direction ltr:rtl.tmSnippet → direction ltrrtl.tmSnippet}
  41. 0  Snippets/{:display block.tmSnippet → display block.tmSnippet}
  42. 0  Snippets/{:display common-types.tmSnippet → display common-types.tmSnippet}
  43. 0  Snippets/{:display inline.tmSnippet → display inline.tmSnippet}
  44. 0  Snippets/{:display table-types.tmSnippet → display table-types.tmSnippet}
  45. 0  Snippets/{:float left:right:none.tmSnippet → float leftrightnone.tmSnippet}
  46. 0  Snippets/{:font size font.tmSnippet → font size font.tmSnippet}
  47. 0  ...e:line-height font-family.tmSnippet → font style variant weight sizeline-height font-family.tmSnippet}
  48. 0  Snippets/{:font-family family.tmSnippet → font-family family.tmSnippet}
  49. 0  Snippets/{:font-size size.tmSnippet → font-size size.tmSnippet}
  50. 0  Snippets/{:font-style normal:italic:oblique.tmSnippet → font-style normalitalicoblique.tmSnippet}
  51. 0  Snippets/{:font-variant normal:small-caps.tmSnippet → font-variant normalsmall-caps.tmSnippet}
  52. 0  Snippets/{:font-weight weight.tmSnippet → font-weight weight.tmSnippet}
  53. 0  Snippets/{:letter-spacing em.tmSnippet → letter-spacing em.tmSnippet}
  54. 0  Snippets/{:letter-spacing px.tmSnippet → letter-spacing px.tmSnippet}
  55. 0  Snippets/{:list-style type position image.tmSnippet → list-style type position image.tmSnippet}
  56. 0  Snippets/{:list-style-image url.tmSnippet → list-style-image url.tmSnippet}
  57. 0  Snippets/{:list-style-position pos.tmSnippet → list-style-position pos.tmSnippet}
  58. 0  Snippets/{:list-style-type asian.tmSnippet → list-style-type asian.tmSnippet}
  59. 0  Snippets/{:list-style-type marker.tmSnippet → list-style-type marker.tmSnippet}
  60. 0  Snippets/{:list-style-type numeric.tmSnippet → list-style-type numeric.tmSnippet}
  61. 0  Snippets/{:list-style-type other.tmSnippet → list-style-type other.tmSnippet}
  62. 0  Snippets/{:list-style-type roman-alpha-greek.tmSnippet → list-style-type roman-alpha-greek.tmSnippet}
  63. 0  Snippets/{:margin T R B L.tmSnippet → margin T R B L.tmSnippet}
  64. 0  Snippets/{:margin V H.tmSnippet → margin V H.tmSnippet}
  65. 0  Snippets/{:margin all.tmSnippet → margin all.tmSnippet}
  66. 0  Snippets/{:margin-bottom length.tmSnippet → margin-bottom length.tmSnippet}
  67. 0  Snippets/{:margin-left length.tmSnippet → margin-left length.tmSnippet}
  68. 0  Snippets/{:margin-right length.tmSnippet → margin-right length.tmSnippet}
  69. 0  Snippets/{:margin-top length.tmSnippet → margin-top length.tmSnippet}
  70. 0  Snippets/{:marker-offset auto.tmSnippet → marker-offset auto.tmSnippet}
  71. 0  Snippets/{:marker-offset length.tmSnippet → marker-offset length.tmSnippet}
  72. 0  Snippets/{:overflow type.tmSnippet → overflow type.tmSnippet}
  73. 0  Snippets/{:padding T R B L.tmSnippet → padding T R B L.tmSnippet}
  74. 0  Snippets/{:padding V H.tmSnippet → padding V H.tmSnippet}
  75. 0  Snippets/{:padding all.tmSnippet → padding all.tmSnippet}
  76. 0  Snippets/{:padding-bottom length.tmSnippet → padding-bottom length.tmSnippet}
  77. 0  Snippets/{:padding-left length.tmSnippet → padding-left length.tmSnippet}
  78. 0  Snippets/{:padding-right length.tmSnippet → padding-right length.tmSnippet}
  79. 0  Snippets/{:padding-top length.tmSnippet → padding-top length.tmSnippet}
  80. 0  Snippets/{:position type.tmSnippet → position type.tmSnippet}
  81. 0  Snippets/{:text-alignleft:center:right.tmSnippet → text-alignleftcenterright.tmSnippet}
  82. 0  ...rline:line-through:blink.tmSnippet → text-decoration noneunderlineoverlineline-throughblink.tmSnippet}
  83. 0  Snippets/{:text-indent length.tmSnippet → text-indent length.tmSnippet}
  84. 0  Snippets/{:text-shadow color-hex x y blur.tmSnippet → text-shadow color-hex x y blur.tmSnippet}
  85. 0  Snippets/{:text-shadow color-rgb x y blur.tmSnippet → text-shadow color-rgb x y blur.tmSnippet}
  86. 0  Snippets/{:text-shadow none.tmSnippet → text-shadow none.tmSnippet}
  87. 0  ...ets/{:text-transform capitalize:upper:lower.tmSnippet → text-transform capitalizeupperlower.tmSnippet}
  88. 0  Snippets/{:text-transform none.tmSnippet → text-transform none.tmSnippet}
  89. 0  Snippets/{:vertical-align type.tmSnippet → vertical-align type.tmSnippet}
  90. 0  Snippets/{:visibility type.tmSnippet → visibility type.tmSnippet}
  91. 0  Snippets/{:white-space normal:pre:nowrap.tmSnippet → white-space normalprenowrap.tmSnippet}
  92. 0  Snippets/{:word-spacing length.tmSnippet → word-spacing length.tmSnippet}
  93. 0  Snippets/{:word-spacing normal.tmSnippet → word-spacing normal.tmSnippet}
  94. 0  Snippets/{:z-index index.tmSnippet → z-index index.tmSnippet}
  95. +10 −0 Support/Rakefile
  96. +10 −0 Support/fixtures/valid_with_options.sass
  97. +58 −0 Support/lib/sass_engine.rb
  98. +41 −0 Support/spec/spec/sass_engine_spec.rb
  99. +6 −0 Support/spec/spec_helper.rb
  100. +6 −6 Syntaxes/Ruby Sass.tmLanguage
View
25 Commands/Compile SASS.tmCommand
@@ -0,0 +1,25 @@
+<?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
+
+require File.join(ENV['TM_BUNDLE_SUPPORT'], "lib/sass_engine")
+SassEngine.new(ENV['TM_FILEPATH']).execute!</string>
+ <key>input</key>
+ <string>document</string>
+ <key>keyEquivalent</key>
+ <string>@r</string>
+ <key>name</key>
+ <string>Compile SASS</string>
+ <key>output</key>
+ <string>showAsTooltip</string>
+ <key>scope</key>
+ <string>source.sass</string>
+ <key>uuid</key>
+ <string>E5F3F81F-4CAA-4D22-93A9-3AB23141F9FD</string>
+</dict>
+</plist>
View
2  Preferences/Symbol List: Selector.tmPreferences
@@ -5,7 +5,7 @@
<key>name</key>
<string>Symbol List: Selector</string>
<key>scope</key>
- <string>meta.selector.sass</string>
+ <string>meta.selector.css</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
View
4 README
@@ -1,3 +1,7 @@
+The bundle will try to use the colors from the CSS scheme. We still have to define some other elements though, since there are elements in SASS that don't exist in CSS (the following list will probably grow when other elements are implemented):
+- constants: variable.other.sass
+
+
This a bundle consisting of the Sass Language file by Bob Aman from http://sporkmonger.com/2007/12/24/sass-textmate-bundle, and a port of the Snippets from the CSS bundle port by myself, Alan Harper
--Alan Harper 2008-03-25 10:23pm
View
0  ...repeat attachment position copy.tmSnippet → ...repeat attachment position copy.tmSnippet
File renamed without changes
View
0  ...kground-attachment scroll:fixed.tmSnippet → ...kground-attachment scroll:fixed.tmSnippet
File renamed without changes
View
0  Snippets/:background-color hex.tmSnippet → Snippets/background-color hex.tmSnippet
File renamed without changes
View
0  Snippets/:background-color name.tmSnippet → Snippets/background-color name.tmSnippet
File renamed without changes
View
0  Snippets/:background-color rgb.tmSnippet → Snippets/background-color rgb.tmSnippet
File renamed without changes
View
0  ...s/:background-color transparent.tmSnippet → ...ts/background-color transparent.tmSnippet
File renamed without changes
View
0  Snippets/:background-image none.tmSnippet → Snippets/background-image none.tmSnippet
File renamed without changes
View
0  Snippets/:background-image url.tmSnippet → Snippets/background-image url.tmSnippet
File renamed without changes
View
0  ...s/:background-position position.tmSnippet → ...ts/background-position position.tmSnippet
File renamed without changes
View
0  ...background-repeat r:r-x:r-y:n-r.tmSnippet → ...ts/background-repeat rr-xr-yn-r.tmSnippet
File renamed without changes
View
0  ...s/:border size style color copy.tmSnippet → ...ts/border size style color copy.tmSnippet
File renamed without changes
View
0  ...er-bottom size style color copy.tmSnippet → ...er-bottom size style color copy.tmSnippet
File renamed without changes
View
0  ...pets/:border-bottom-color color.tmSnippet → Snippets/border-bottom-color color.tmSnippet
File renamed without changes
View
0  ...pets/:border-bottom-style style.tmSnippet → Snippets/border-bottom-style style.tmSnippet
File renamed without changes
View
0  .../:border-bottom-width size copy.tmSnippet → ...s/border-bottom-width size copy.tmSnippet
File renamed without changes
View
0  Snippets/:border-color color copy.tmSnippet → Snippets/border-color color copy.tmSnippet
File renamed without changes
View
0  ...s/:border-left size style color.tmSnippet → ...ts/border-left size style color.tmSnippet
File renamed without changes
View
0  Snippets/:border-left-color color.tmSnippet → Snippets/border-left-color color.tmSnippet
File renamed without changes
View
0  Snippets/:border-left-style style.tmSnippet → Snippets/border-left-style style.tmSnippet
File renamed without changes
View
0  Snippets/:border-left-width size.tmSnippet → Snippets/border-left-width size.tmSnippet
File renamed without changes
View
0  .../:border-right size style color.tmSnippet → ...s/border-right size style color.tmSnippet
File renamed without changes
View
0  Snippets/:border-right-color color.tmSnippet → Snippets/border-right-color color.tmSnippet
File renamed without changes
View
0  Snippets/:border-right-style style.tmSnippet → Snippets/border-right-style style.tmSnippet
File renamed without changes
View
0  Snippets/:border-right-width size.tmSnippet → Snippets/border-right-width size.tmSnippet
File renamed without changes
View
0  Snippets/:border-style style copy.tmSnippet → Snippets/border-style style copy.tmSnippet
File renamed without changes
View
0  ...ts/:border-top size style color.tmSnippet → ...ets/border-top size style color.tmSnippet
File renamed without changes
View
0  Snippets/:border-top-color color.tmSnippet → Snippets/border-top-color color.tmSnippet
File renamed without changes
View
0  Snippets/:border-top-style style.tmSnippet → Snippets/border-top-style style.tmSnippet
File renamed without changes
View
0  Snippets/:border-top-width size.tmSnippet → Snippets/border-top-width size.tmSnippet
File renamed without changes
View
0  Snippets/:border-width size copy.tmSnippet → Snippets/border-width size copy.tmSnippet
File renamed without changes
View
0  Snippets/:clear value.tmSnippet → Snippets/clear value.tmSnippet
File renamed without changes
View
0  Snippets/:color hex.tmSnippet → Snippets/color hex.tmSnippet
File renamed without changes
View
0  Snippets/:color name.tmSnippet → Snippets/color name.tmSnippet
File renamed without changes
View
0  Snippets/:color rgb.tmSnippet → Snippets/color rgb.tmSnippet
File renamed without changes
View
0  Snippets/:cursor type.tmSnippet → Snippets/cursor type.tmSnippet
File renamed without changes
View
0  Snippets/:cursor url.tmSnippet → Snippets/cursor url.tmSnippet
File renamed without changes
View
0  Snippets/:direction ltr:rtl.tmSnippet → Snippets/direction ltrrtl.tmSnippet
File renamed without changes
View
0  Snippets/:display block.tmSnippet → Snippets/display block.tmSnippet
File renamed without changes
View
0  Snippets/:display common-types.tmSnippet → Snippets/display common-types.tmSnippet
File renamed without changes
View
0  Snippets/:display inline.tmSnippet → Snippets/display inline.tmSnippet
File renamed without changes
View
0  Snippets/:display table-types.tmSnippet → Snippets/display table-types.tmSnippet
File renamed without changes
View
0  Snippets/:float left:right:none.tmSnippet → Snippets/float leftrightnone.tmSnippet
File renamed without changes
View
0  Snippets/:font size font.tmSnippet → Snippets/font size font.tmSnippet
File renamed without changes
View
0  ...ht size:line-height font-family.tmSnippet → ...ght sizeline-height font-family.tmSnippet
File renamed without changes
View
0  Snippets/:font-family family.tmSnippet → Snippets/font-family family.tmSnippet
File renamed without changes
View
0  Snippets/:font-size size.tmSnippet → Snippets/font-size size.tmSnippet
File renamed without changes
View
0  ...ont-style normal:italic:oblique.tmSnippet → .../font-style normalitalicoblique.tmSnippet
File renamed without changes
View
0  ...:font-variant normal:small-caps.tmSnippet → ...s/font-variant normalsmall-caps.tmSnippet
File renamed without changes
View
0  Snippets/:font-weight weight.tmSnippet → Snippets/font-weight weight.tmSnippet
File renamed without changes
View
0  Snippets/:letter-spacing em.tmSnippet → Snippets/letter-spacing em.tmSnippet
File renamed without changes
View
0  Snippets/:letter-spacing px.tmSnippet → Snippets/letter-spacing px.tmSnippet
File renamed without changes
View
0  ...:list-style type position image.tmSnippet → .../list-style type position image.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-image url.tmSnippet → Snippets/list-style-image url.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-position pos.tmSnippet → Snippets/list-style-position pos.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-type asian.tmSnippet → Snippets/list-style-type asian.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-type marker.tmSnippet → Snippets/list-style-type marker.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-type numeric.tmSnippet → Snippets/list-style-type numeric.tmSnippet
File renamed without changes
View
0  Snippets/:list-style-type other.tmSnippet → Snippets/list-style-type other.tmSnippet
File renamed without changes
View
0  ...st-style-type roman-alpha-greek.tmSnippet → ...st-style-type roman-alpha-greek.tmSnippet
File renamed without changes
View
0  Snippets/:margin T R B L.tmSnippet → Snippets/margin T R B L.tmSnippet
File renamed without changes
View
0  Snippets/:margin V H.tmSnippet → Snippets/margin V H.tmSnippet
File renamed without changes
View
0  Snippets/:margin all.tmSnippet → Snippets/margin all.tmSnippet
File renamed without changes
View
0  Snippets/:margin-bottom length.tmSnippet → Snippets/margin-bottom length.tmSnippet
File renamed without changes
View
0  Snippets/:margin-left length.tmSnippet → Snippets/margin-left length.tmSnippet
File renamed without changes
View
0  Snippets/:margin-right length.tmSnippet → Snippets/margin-right length.tmSnippet
File renamed without changes
View
0  Snippets/:margin-top length.tmSnippet → Snippets/margin-top length.tmSnippet
File renamed without changes
View
0  Snippets/:marker-offset auto.tmSnippet → Snippets/marker-offset auto.tmSnippet
File renamed without changes
View
0  Snippets/:marker-offset length.tmSnippet → Snippets/marker-offset length.tmSnippet
File renamed without changes
View
0  Snippets/:overflow type.tmSnippet → Snippets/overflow type.tmSnippet
File renamed without changes
View
0  Snippets/:padding T R B L.tmSnippet → Snippets/padding T R B L.tmSnippet
File renamed without changes
View
0  Snippets/:padding V H.tmSnippet → Snippets/padding V H.tmSnippet
File renamed without changes
View
0  Snippets/:padding all.tmSnippet → Snippets/padding all.tmSnippet
File renamed without changes
View
0  Snippets/:padding-bottom length.tmSnippet → Snippets/padding-bottom length.tmSnippet
File renamed without changes
View
0  Snippets/:padding-left length.tmSnippet → Snippets/padding-left length.tmSnippet
File renamed without changes
View
0  Snippets/:padding-right length.tmSnippet → Snippets/padding-right length.tmSnippet
File renamed without changes
View
0  Snippets/:padding-top length.tmSnippet → Snippets/padding-top length.tmSnippet
File renamed without changes
View
0  Snippets/:position type.tmSnippet → Snippets/position type.tmSnippet
File renamed without changes
View
0  ...ts/:text-alignleft:center:right.tmSnippet → Snippets/text-alignleftcenterright.tmSnippet
File renamed without changes
View
0  ...ine:overline:line-through:blink.tmSnippet → ...erlineoverlineline-throughblink.tmSnippet
File renamed without changes
View
0  Snippets/:text-indent length.tmSnippet → Snippets/text-indent length.tmSnippet
File renamed without changes
View
0  ...:text-shadow color-hex x y blur.tmSnippet → .../text-shadow color-hex x y blur.tmSnippet
File renamed without changes
View
0  ...:text-shadow color-rgb x y blur.tmSnippet → .../text-shadow color-rgb x y blur.tmSnippet
File renamed without changes
View
0  Snippets/:text-shadow none.tmSnippet → Snippets/text-shadow none.tmSnippet
File renamed without changes
View
0  ...ransform capitalize:upper:lower.tmSnippet → ...-transform capitalizeupperlower.tmSnippet
File renamed without changes
View
0  Snippets/:text-transform none.tmSnippet → Snippets/text-transform none.tmSnippet
File renamed without changes
View
0  Snippets/:vertical-align type.tmSnippet → Snippets/vertical-align type.tmSnippet
File renamed without changes
View
0  Snippets/:visibility type.tmSnippet → Snippets/visibility type.tmSnippet
File renamed without changes
View
0  .../:white-space normal:pre:nowrap.tmSnippet → ...ets/white-space normalprenowrap.tmSnippet
File renamed without changes
View
0  Snippets/:word-spacing length.tmSnippet → Snippets/word-spacing length.tmSnippet
File renamed without changes
View
0  Snippets/:word-spacing normal.tmSnippet → Snippets/word-spacing normal.tmSnippet
File renamed without changes
View
0  Snippets/:z-index index.tmSnippet → Snippets/z-index index.tmSnippet
File renamed without changes
View
10 Support/Rakefile
@@ -0,0 +1,10 @@
+$:.unshift(File.dirname(__FILE__) + '/../../rspec/lib')
+require 'rubygems'
+require 'spec/rake/spectask'
+
+desc "Run all specs"
+Spec::Rake::SpecTask.new do |t|
+ t.rcov = true
+ t.spec_opts = ['--colour', '--diff']
+ t.rcov_opts = ['--exclude', 'rspec\/plugins,rspec\/lib\/spec,spec\/spec,fixtures,bin\/spec']
+end
View
10 Support/fixtures/valid_with_options.sass
@@ -0,0 +1,10 @@
+// preview: preview.html, output: output.css, engine: sass, flags: -s
+
+!color = #000
+
+body.awesome
+ :width 1000px
+
+ #header
+ :border= 1px solid !color
+
View
58 Support/lib/sass_engine.rb
@@ -0,0 +1,58 @@
+class SassEngine
+ def initialize(filename)
+ raise "You must supply a filename to compile." unless filename
+ @filename = filename
+ end
+
+ def execute!
+ compile!
+ preview!
+ end
+
+
+private
+ def compile!
+ command = options.empty? ? "cat" : "tail -n +2"
+ Kernel.system("#{command} #{@filename} | sass #{flags} -s > #{output_filename}")
+ end
+
+ def preview!
+ Kernel.system("open -g #{preview_filename}") if process_status.exitstatus.zero? && preview_filename
+ end
+
+ def process_status
+ $?
+ end
+
+
+ def options
+ return {} unless File.file?(@filename)
+ first_line = File.open(@filename) {|f| f.readline unless f.eof} || ''
+ return {} unless first_line.match(/\s*\/\/\s*(.+:.+)/)
+
+ $1.split(',').inject({}) do |hash, pair|
+ k,v = pair.split(':')
+ hash[k.strip.to_sym] = v.strip if k && v
+ hash
+ end
+ end
+ alias :options_no_memo :options
+ def options; @options ||= options_no_memo end
+
+ def type
+ @type ||= @filename[/.+\.(.+)/,1].to_sym
+ end
+
+ def flags
+ options[:flags]
+ end
+
+ def output_filename
+ @output_filename ||= options[:output] || (@filename[/(.*)\.#{type}/,1] + ".css")
+ end
+
+ def preview_filename
+ return if options[:preview] == "none"
+ @preview_filename ||= File.join(File.split(@filename)[0], options[:preview]) if options[:preview]
+ end
+end
View
41 Support/spec/spec/sass_engine_spec.rb
@@ -0,0 +1,41 @@
+require File.join(File.dirname(__FILE__), '../spec_helper')
+
+describe SassEngine do
+ before(:each) do
+ @filename = File.expand_path(File.join(File.dirname(__FILE__), "../../fixtures", "valid_with_options.sass"))
+ @output_filename = "output.css"
+ @preview_filename = "preview.html"
+ @flags = "-s"
+
+ @sass_engine = SassEngine.new(@filename)
+ end
+
+ describe "execution" do
+ before(:each) do
+ Kernel.stub!(:system).and_return(true)
+
+ @status = mock("process status", :exitstatus => 0)
+ @sass_engine.stub!(:process_status).and_return(@status)
+ end
+
+ it "should pipe the output to the engine" do
+ #expects
+ Kernel.should_receive(:system).with(/#@filename.*sass.*#@flags.*#@output_filename/)
+ #when
+ @sass_engine.execute!
+ end
+
+ it "should open the preview file if there was no error" do
+ #expects
+ Kernel.should_receive(:system).with(/open -g.*#@preview_filename/)
+ #when
+ @sass_engine.execute!
+ end
+ end
+
+ describe "filenames" do
+ it "should require a filename" do
+ lambda { SassEngine.new }.should raise_error
+ end
+ end
+end
View
6 Support/spec/spec_helper.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+require 'spec'
+
+ENV['TM_SUPPORT_PATH'] = '/Applications/TextMate.app/Contents/SharedSupport/Support'
+
+require File.expand_path(File.join(File.dirname(__FILE__), "../lib", "sass_engine"))
View
12 Syntaxes/Ruby Sass.tmLanguage
@@ -133,7 +133,7 @@
</dict>
</dict>
<key>name</key>
- <string>meta.selector.sass</string>
+ <string>meta.selector.css</string>
<key>patterns</key>
<array>
<dict>
@@ -142,7 +142,7 @@
</dict>
<dict>
<key>match</key>
- <string>\b(a|abbr|acronym|address|area|b|base|big|blockquote|body|br|button|caption|cite|code|col|colgroup|dd|del|dfn|div|dl|dt|em|fieldset|form|frame|frameset|(h[1-6])|head|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|meta|noframes|noscript|object|ol|optgroup|option|p|param|pre|q|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|ul|var)\b</string>
+ <string>\b(a|abbr|acronym|address|area|b|base|big|blockquote|body|br|button|caption|cite|code|col|colgroup|dd|del|dfn|div|dl|dt|em|fieldset|form|frame|frameset|(h[1-6])|head|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|meta|noframes|noscript|object|ol|optgroup|option|p|param|pre|q|samp|script|select|small|span|strike|strong|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|ul|var)\b</string>
<key>name</key>
<string>entity.name.tag.css.sass</string>
</dict>
@@ -517,13 +517,13 @@
<key>match</key>
<string>(-|\+)?\s*[0-9]+(\.[0-9]+)?</string>
<key>name</key>
- <string>constant.numeric.sass</string>
+ <string>constant.numeric.css</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[\d])(px|pt|cm|mm|in|em|ex|pc)\b|%</string>
<key>name</key>
- <string>keyword.other.unit.sass</string>
+ <string>keyword.other.unit.css</string>
</dict>
<dict>
<key>captures</key>
@@ -531,13 +531,13 @@
<key>1</key>
<dict>
<key>name</key>
- <string>punctuation.definition.constant.sass</string>
+ <string>punctuation.definition.constant.css</string>
</dict>
</dict>
<key>match</key>
<string>(#)([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b</string>
<key>name</key>
- <string>constant.other.color.rgb-value.sass</string>
+ <string>constant.other.color.rgb-value.css</string>
</dict>
<dict>
<key>include</key>
Please sign in to comment.
Something went wrong with that request. Please try again.