Sha256: 035782991b949c09f079d21afc146d8ac494aecd952eb96d1d8a09f03fb1cfca

Contents?: true

Size: 794 Bytes

Versions: 5

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

module Mako
  class SassRenderer
    include FileOpenUtil

    attr_reader :template

    def initialize(args)
      @template = args.fetch(:template, File.expand_path(File.join('themes', "#{Mako.config.theme}.scss"), Dir.pwd))
    end

    # Wrapper for Sass::Engine.  Creates new Sass::Engine instance with main
    # Sass file and renders it.
    #
    # @return [String]
    def render
      Sass::Engine.new(load_resource(template), syntax: :scss,
                                                load_paths: [File.expand_path('themes/', Dir.pwd)],
                                                style: :compressed).render
    end

    # Default file name for rendererd file.
    #
    # @return [String]
    def file_path
      'main.css'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mako_rss-0.2.3 lib/mako/sass_renderer.rb
mako_rss-0.2.2 lib/mako/sass_renderer.rb
mako_rss-0.2.1 lib/mako/sass_renderer.rb
mako_rss-0.2.0 lib/mako/sass_renderer.rb
mako_rss-0.1.0 lib/mako/sass_renderer.rb