Class: Sass::Tree::FileNode

Inherits:
Node show all
Defined in:
lib/sass/tree/file_node.rb

Overview

A static node that wraps the Sass::Tree for an ‘@import`ed file. It doesn’t have a functional purpose other than to add the ‘@import`ed file to the backtrace if an error occurs.

Instance Attribute Summary

Attributes inherited from Node

#children, #filename, #line, #options

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #last, #perform, #render, #style, #to_sass

Constructor Details

#initialize(filename) ⇒ FileNode

Returns a new instance of FileNode.

Parameters:

  • filename (String)

    The name of the imported file



8
9
10
11
# File 'lib/sass/tree/file_node.rb', line 8

def initialize(filename)
  @filename = filename
  super()
end

Instance Method Details

#invisible?Boolean

Returns:

  • (Boolean)


23
# File 'lib/sass/tree/file_node.rb', line 23

def invisible?; to_s.empty?; end

#to_s(*args) ⇒ Object

Computes the CSS for the imported file.

Parameters:

  • args (Array)

    Ignored



16
17
18
19
20
21
# File 'lib/sass/tree/file_node.rb', line 16

def to_s(*args)
  @to_s ||= (style == :compressed ? super().strip : super())
rescue Sass::SyntaxError => e
  e.add_backtrace_entry(@filename)
  raise e
end