summaryrefslogtreecommitdiff
path: root/config/initializers/sass_extensions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/sass_extensions.rb')
-rw-r--r--config/initializers/sass_extensions.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/config/initializers/sass_extensions.rb b/config/initializers/sass_extensions.rb
new file mode 100644
index 0000000..984f1ae
--- /dev/null
+++ b/config/initializers/sass_extensions.rb
@@ -0,0 +1,25 @@
+##
+## define here new extensions you want available in sass stylesheets.
+##
+
+module Sass::Script::Functions
+
+ #
+ # takes a border string, like '1px solid green'
+ # and returns 1px
+ #
+ def border_width(string)
+ string = string.to_s
+ if string =~ /px/
+ Sass::Script::Number.new(string.split(' ').first.to_i, ['px'])
+ else
+ Sass::Script::Number.new(0,['px'])
+ end
+ end
+
+ def border_color(string)
+ assert_type string, :String
+ Sass::Script::String.new(string.to_s.split(' ').last)
+ end
+
+end