Sha256: b0b5171c8f7de55a24ff76c99e0228f3c1d0315d7a13671a61681293ac0b61f3

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Padrino
  module Generators
    module Components
      module Stylesheets
        module SassGen
          SASS_INIT = (<<-SASS).gsub(/^ {10}/, '')
          # Enables support for SASS template reloading for rack.
          # Store SASS files by default within 'app/stylesheets/sass'
          # See http://nex-3.com/posts/88-sass-supports-rack for more details.

          module SassInitializer
            def self.registered(app)
              require 'sass/plugin/rack'
              Sass::Plugin.options[:template_location] = Padrino.root("app/stylesheets")
              Sass::Plugin.options[:css_location] = Padrino.root("public/stylesheets")
              app.use Sass::Plugin::Rack
            end
          end
          SASS

          SASS_REGISTER = (<<-SASSR).gsub(/^ {10}/, '')
              register SassInitializer\n
          SASSR

          def setup_stylesheet
            require_dependencies 'haml'
            create_file destination_root('/lib/sass.rb'), SASS_INIT
            inject_into_file destination_root('/app/app.rb'), SASS_REGISTER, :after => "configure do\n"
            empty_directory destination_root('/app/stylesheets')
          end
        end # SassGen
      end # Stylesheets
    end # Components
  end # Generators
end # Padrino

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
padrino-gen-0.9.9 lib/padrino-gen/generators/components/stylesheets/sass_gen.rb
padrino-gen-0.9.7 lib/padrino-gen/generators/components/stylesheets/sass_gen.rb