utils.rb 771 B

12345678910111213141516171819202122232425262728293031
  1. module SenchaTouch
  2. module SassExtensions
  3. module Functions
  4. module Utils
  5. # Joins 2 file paths using the path separator
  6. def file_join(path1, path2)
  7. path1 = path1.value
  8. path2 = path2.value
  9. path = path1.empty? ? path2 : File.join(path1, path2)
  10. Sass::Script::String.new(path)
  11. end
  12. def file_exists(directory, path)
  13. result = false
  14. where_to_look = File.join(directory.value, path.value)
  15. if where_to_look && FileTest.exists?("#{where_to_look}")
  16. result = true
  17. end
  18. return Sass::Script::Bool.new(result)
  19. end
  20. end
  21. end
  22. end
  23. end
  24. module Sass::Script::Functions
  25. include SenchaTouch::SassExtensions::Functions::Utils
  26. end