Sha256: 2ec8c3d673987cab6a50b1c42c7b8bf71034f24568c1accc2eeb42e5d1eb0052

Contents?: true

Size: 1.7 KB

Versions: 27

Compression:

Stored size: 1.7 KB

Contents

module Sass::Tree
  # A node representing an `@import` rule that's importing plain CSS.
  #
  # @see Sass::Tree
  class CssImportNode < DirectiveNode
    # The URI being imported, either as a plain string or an interpolated
    # script string.
    #
    # @return [String, Sass::Script::Node]
    attr_accessor :uri

    # The text of the URI being imported after any interpolated SassScript has
    # been resolved. Only set once \{Tree::Visitors::Perform} has been run.
    #
    # @return [String]
    attr_accessor :resolved_uri

    # The media query for this rule, interspersed with {Sass::Script::Node}s
    # representing `#{}`-interpolation. Any adjacent strings will be merged
    # together.
    #
    # @return [Array<String, Sass::Script::Node>]
    attr_accessor :query

    # The media query for this rule, without any unresolved interpolation. It's
    # only set once {Tree::Node#perform} has been called.
    #
    # @return [Sass::Media::QueryList]
    attr_accessor :resolved_query

    # @param uri [String, Sass::Script::Node] See \{#uri}
    # @param query [Array<String, Sass::Script::Node>] See \{#query}
    def initialize(uri, query = [])
      @uri = uri
      @query = query
      super('')
    end

    # @param uri [String] See \{#resolved_uri}
    # @return [CssImportNode]
    def self.resolved(uri)
      node = new(uri)
      node.resolved_uri = uri
      node
    end

    # @see DirectiveNode#value
    def value; raise NotImplementedError; end

    # @see DirectiveNode#resolved_value
    def resolved_value
      @resolved_value ||=
        begin
          str = "@import #{resolved_uri}"
          str << " #{resolved_query.to_css}" if resolved_query
          str
        end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
sass-3.3.0.alpha.149 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.144 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.142 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.141 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.138 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.136 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.134 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.133 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.129 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.128 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.127 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.132 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.121 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.120 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.107 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.103 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.102 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.101 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.93 lib/sass/tree/css_import_node.rb
sass-3.3.0.alpha.88 lib/sass/tree/css_import_node.rb