class Sass::Tree::PropNode

def declaration(opts = {:old => @prop_syntax == :old}, fmt = :sass)

Parameters:
  • fmt (Symbol) -- `:scss` or `:sass`.
  • opts ({Symbol => Object}) -- The options hash for the tree.
def declaration(opts = {:old => @prop_syntax == :old}, fmt = :sass)
  name = self.name.map {|n| n.is_a?(String) ? n : n.to_sass(opts)}.join
  value = self.value.map {|n| n.is_a?(String) ? n : n.to_sass(opts)}.join
  value = "(#{value})" if value_needs_parens?
  if name[0] == ?:
    raise Sass::SyntaxError.new("The \"#{name}: #{value}\"" +
                                " hack is not allowed in the Sass indented syntax")
  end
  # The indented syntax doesn't support newlines in custom property values,
  # but we can losslessly convert them to spaces instead.
  value = value.tr("\n", " ") if fmt == :sass
  old = opts[:old] && fmt == :sass
  "#{old ? ':' : ''}#{name}#{old ? '' : ':'}#{custom_property? ? '' : ' '}#{value}".rstrip
end