Sha256: 9b6a56078c9d086f564bb5327152102a031d9e857e11b57b5232e910400210bd

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

LESS_INIT = (<<-LESS).gsub(/^ {10}/, '') unless defined?(LESS_INIT)
# Enables support for Less template reloading for rack.
# Store Less files by default within 'app/stylesheets/'
# See http://github.com/kelredd/rack-less for more details.

module LessInitializer
  def self.registered(app)
    require 'rack/less'
    # optional - use as necessary
    Rack::Less.configure do |config|
      config.compress = true
      # other configs ...
    end
    app.use Rack::Less,
    :root      => app.root,
    :source    => 'stylesheets/',
    :public    => 'public/',
    :hosted_at => '/stylesheets'
  end
end

LESS

LESS_REGISTER = (<<-LESSR).gsub(/^ {10}/, '') unless defined?(LESS_REGISTER)
    register LessInitializer\n
LESSR

def setup_stylesheet
  require_dependencies 'less', 'rack-less'
  create_file destination_root('/lib/less_plugin.rb'), LESS_INIT
  inject_into_file destination_root('/app/app.rb'), LESS_REGISTER, :after => "configure do\n"
  empty_directory destination_root('/app/stylesheets')
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
padrino-gen-0.9.10 lib/padrino-gen/generators/components/stylesheets/less.rb