Class: Sass::Tree::CssImportNode

Inherits:
DirectiveNode show all
Defined in:
/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb

Overview

A node representing an @import rule that’s importing plain CSS.

See Also:

Instance Attribute Summary (collapse)

Attributes inherited from DirectiveNode

#group_end, #tabs

Attributes inherited from Node

#children, #filename, #has_children, #line, #options, #source_range

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from DirectiveNode

#bubbles?, #name, #normalized_name

Methods inherited from Node

#<<, #==, #balance, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #invisible?, #style, #to_sass, #to_scss

Constructor Details

- (CssImportNode) initialize(uri, query = [], supports_condition = nil)

Returns a new instance of CssImportNode

Parameters:



39
40
41
42
43
44
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 39

def initialize(uri, query = [], supports_condition = nil)
  @uri = uri
  @query = query
  @supports_condition = supports_condition
  super('')
end

Instance Attribute Details

- (Array<String, Sass::Script::Tree::Node>) query

The media query for this rule, interspersed with Script::Tree::Nodes representing #{}-interpolation. Any adjacent strings will be merged together.

Returns:



28
29
30
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 28

def query
  @query
end

- (Sass::Media::QueryList) resolved_query

The media query for this rule, without any unresolved interpolation. It’s only set once Visitors::Perform has been run.



34
35
36
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 34

def resolved_query
  @resolved_query
end

- (String) resolved_uri

The text of the URI being imported after any interpolated SassScript has been resolved. Only set once Visitors::Perform has been run.

Returns:

  • (String)


16
17
18
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 16

def resolved_uri
  @resolved_uri
end

- (Sass::Supports::Condition) supports_condition

The supports condition for this import.



21
22
23
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 21

def supports_condition
  @supports_condition
end

- (String, Sass::Script::Tree::Node) uri

The URI being imported, either as a plain string or an interpolated script string.

Returns:



10
11
12
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 10

def uri
  @uri
end

Class Method Details

+ (CssImportNode) resolved(uri)

Parameters:

Returns:



48
49
50
51
52
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 48

def self.resolved(uri)
  node = new(uri)
  node.resolved_uri = uri
  node
end

Instance Method Details

- resolved_value



58
59
60
61
62
63
64
65
66
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 58

def resolved_value
  @resolved_value ||=
    begin
      str = "@import #{resolved_uri}"
      str << " supports(#{supports_condition.to_css})" if supports_condition
      str << " #{resolved_query.to_css}" if resolved_query
      str
    end
end

- value

Raises:

  • (NotImplementedError)

See Also:



55
# File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/css_import_node.rb', line 55

def value; raise NotImplementedError; end