module Sass::Script::Functions

Public Instance Methods

relocatable(path) click to toggle source

Return the correct relative path for the given path.

    # File lib/webgen/content_processor/sass.rb
108 def relocatable(path)
109   assert_type(path, :String)
110   context = options[:webgen_context]
111   path = path.value
112 
113   ref_node = context.website.tree[options[:filename]]
114   ref_node = context.website.tree.root if ref_node.nil? && path[0] == ?/
115 
116   if ref_node
117     if dest_node = ref_node.resolve(path, context.dest_node.lang, true)
118       context.website.ext.item_tracker.add(context.dest_node, :node_meta_info, dest_node)
119       path = context.dest_node.route_to(dest_node)
120     end
121   else
122     context.website.logger.warn { "Couldn't determine reference node for resolving node in Sass file." }
123   end
124   ::Sass::Script::String.new(path, :string)
125 end