GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Support for relative Sass imports.
chriseppstein (author)
Thu Oct 02 11:34:22 -0700 2008
commit  d132121e4e3ff699d4792f7b411d5ac0de41bfa8
tree    511a1bdb2cc79496c9c3d4541d6aeae049ac96b8
parent  cd8a7c2168beb23c7af0ba29a62956f5a547657c
...
77
78
79
 
80
81
82
...
77
78
79
80
81
82
83
0
@@ -77,6 +77,7 @@ module Haml
0
         input_file, output_file = if input
0
                                     [nil, open_file(ARGV[0], 'w')]
0
                                   else
0
+ @options[:for_engine][:filename] = ARGV[0]
0
                                     [open_file(ARGV[0]), open_file(ARGV[1], 'w')]
0
                                   end
0
 
...
456
457
458
 
 
 
 
 
 
 
459
460
461
...
520
521
522
 
 
 
523
524
525
526
 
527
528
529
...
456
457
458
459
460
461
462
463
464
465
466
467
468
...
527
528
529
530
531
532
533
 
 
 
534
535
536
537
0
@@ -456,6 +456,13 @@ END
0
       paths
0
     end
0
 
0
+ def import_paths
0
+ paths = []
0
+ paths << File.dirname(@options[:filename]) if @options[:filename]
0
+ paths += @options[:load_paths] if @options[:load_paths]
0
+ paths
0
+ end
0
+
0
     def import(files)
0
       nodes = []
0
 
0
@@ -520,10 +527,11 @@ END
0
     end
0
 
0
     def self.find_full_path(filename, load_paths)
0
+ segments = filename.split(File::SEPARATOR)
0
+ segments.push "_#{segments.pop}"
0
+ partial_name = segments.join(File::SEPARATOR)
0
       load_paths.each do |path|
0
- segments = filename.split(File::SEPARATOR)
0
- segments.push "_#{segments.pop}"
0
- [segments.join(File::SEPARATOR), filename].each do |name|
0
+ [partial_name, filename].each do |name|
0
           full_path = File.join(path, name)
0
           if File.readable?(full_path)
0
             return full_path
...
191
192
193
194
 
195
196
197
...
191
192
193
 
194
195
196
197
0
@@ -191,7 +191,7 @@ END
0
       def dependencies(filename)
0
         File.readlines(filename).grep(/^@import /).map do |line|
0
           line[8..-1].split(',').map do |inc|
0
- Sass::Engine.find_file_to_import(inc.strip, load_paths)
0
+ Sass::Engine.find_file_to_import(inc.strip, [File.dirname(filename)] + load_paths)
0
           end
0
         end.flatten.grep(/\.sass$/)
0
       end
...
 
 
1
2
...
1
2
3
4
0
@@ -1 +1,3 @@
0
+#nested { relative: true; }
0
+
0
 #subdir { font-size: 20px; font-weight: bold; }
0
\ No newline at end of file
...
 
 
1
2
3
4
5
6
7
...
1
2
3
4
5
6
 
 
7
0
@@ -1,6 +1,6 @@
0
+@import nested_subdir/nested_partial.sass
0
+
0
 #subdir
0
   :font
0
     :size 20px
0
     :weight bold
0
-
0
-
0
\ No newline at end of file

Comments

    No one has commented yet.