Sha256: ecab27d89d4d020ba0abe3793d4f5d7f8adfa580a46e8caa78802638ec5cb2ad

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Nesta
  module Overrides
    module Renderers
      def find_template(views, name, engine, &block)
        user_paths = [
          Nesta::Overrides.local_view_path,
          Nesta::Overrides.theme_view_path,
          views
        ].flatten.compact
        user_paths.each do |path|
          super(path, name, engine, &block)
        end
      end

      def stylesheet(template, options = {}, locals = {})
        scss(template, options, locals)
      rescue Errno::ENOENT
        sass(template, options, locals)
      end
    end

    def self.local_view_path
      Nesta::Path.local("views")
    end
  
    def self.theme_view_path
      if Nesta::Config.theme.nil?
        nil
      else
        Nesta::Path.themes(Nesta::Config.theme, "views")
      end
    end

    def self.load_local_app
      app_file = Nesta::Path.local('app.rb')
      require app_file if File.exist?(app_file)
    end
    
    def self.load_theme_app
      if Nesta::Config.theme
        app_file = Nesta::Path.themes(Nesta::Config.theme, 'app.rb')
        require app_file if File.exist?(app_file)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nesta-0.18.0 lib/nesta/overrides.rb
nesta-0.17.0 lib/nesta/overrides.rb
nesta-0.16.0 lib/nesta/overrides.rb