Sha256: 76a87171b3b5b38b6e73edaef9a1d5984db86d6cd83c8503098c4f62efe95f8a

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

module Luca
  class Stylesheet
    attr_accessor :path, :source, :compiler

    def initialize(path)
      @source = @path = path
      @compiler = AssetCompiler.new(file: path, type: type)
    end

    def to_change_notification
      as_json
    end

    # TODO: Add support for less, sass, etc
    def type
      "scss"
    end

    def compiled
      @compiler.compiled rescue ""
    end

    def as_json options={}
      {
        defined_in_file:  source, 
        type:             "stylesheet", 
        compiled:         compiled,
        source_file_contents:  IO.read(source),
        name:             File.basename(source),
        # temp
        path:             source.gsub(::Rails.root.to_s, '.'),
        id:               source.gsub(::Rails.root.to_s, '.').gsub('/','__')
      }
    end
  end  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
luca-0.9.899 lib/luca/stylesheet.rb
luca-0.9.89 lib/luca/stylesheet.rb