Class: Sass::Tree::CssImportNode

Inherits:
DirectiveNode show all
Defined in:
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

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

Returns a new instance of CssImportNode.

Parameters:



39
40
41
42
43
44
# File '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

#queryArray<String, Sass::Script::Tree::Node>

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 'lib/sass/tree/css_import_node.rb', line 28

def query
  @query
end

#resolved_querySass::Media::QueryList

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



34
35
36
# File 'lib/sass/tree/css_import_node.rb', line 34

def resolved_query
  @resolved_query
end

#resolved_uriString

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 'lib/sass/tree/css_import_node.rb', line 16

def resolved_uri
  @resolved_uri
end

#supports_conditionSass::Supports::Condition

The supports condition for this import.



21
22
23
# File 'lib/sass/tree/css_import_node.rb', line 21

def supports_condition
  @supports_condition
end

#uriString, Sass::Script::Tree::Node

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

Returns:



10
11
12
# File 'lib/sass/tree/css_import_node.rb', line 10

def uri
  @uri
end

Class Method Details

.resolved(uri) ⇒ CssImportNode

Parameters:

Returns:



48
49
50
51
52
# File '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 '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 'lib/sass/tree/css_import_node.rb', line 55

def value; raise NotImplementedError; end