Sha256: eefb9365045f6ce492094632d5f83aa5883173ce36dfed6448c4c82079d8b195

Contents?: true

Size: 613 Bytes

Versions: 9

Compression:

Stored size: 613 Bytes

Contents

require 'sass'

module SCSSLint
  class Engine
    ENGINE_OPTIONS = { cache: false, syntax: :scss }

    attr_reader :contents, :filename, :lines, :tree

    def initialize(scss_or_filename)
      if File.exists?(scss_or_filename)
        @filename = scss_or_filename
        @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS)
        @contents = File.open(scss_or_filename, 'r').read
      else
        @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS)
        @contents = scss_or_filename
      end

      @lines = @contents.split("\n")
      @tree = @engine.to_tree
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scss-lint-0.13.0 lib/scss_lint/engine.rb
scss-lint-0.12.1 lib/scss_lint/engine.rb
scss-lint-0.12.0 lib/scss_lint/engine.rb
scss-lint-0.11.1 lib/scss_lint/engine.rb
scss-lint-0.10.1 lib/scss_lint/engine.rb
scss-lint-0.10.0 lib/scss_lint/engine.rb
scss-lint-0.9.0 lib/scss_lint/engine.rb
scss-lint-0.7.1 lib/scss_lint/engine.rb
scss-lint-0.7.0 lib/scss_lint/engine.rb