Skip to content

ku1ik/rack-lesscss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack::LessCss

About

Rack::LessCss, is a Rack middleware which converts .less files into .css files on the fly during request. It’s main purpose is to ease development stage when you change your .less files frequently. With rack-lesscss middleware enabled you don’t need to compile .less files by hand after every change. LessCSS compiler has an option to watch for changes in .less file and automatically recompiles it but you need to remember to run compiler in watch mode for every stylesheet every time you start development session. There are also at least two Rails plugins which nicely integrates LessCSS into the app but this middleware can be used with Rails as well as with other ruby web frameworks like Merb or Sinatra.

Installation

gem install rack-lesscss

Usage

Enable in Merb:

config/dependencies.rb:

dependency "rack-lesscss"

config/rack.rb (before line with run Merb::Rack::Application.new):

use Rack::LessCss, :less_path => File.join(Merb.root, "public", "less")

Enable in Rails:

config/environment.rb:

config.gem "rack-lesscss"
config.middleware.use "Rack::LessCss", :less_path => File.join(RAILS_ROOT, "public", "less")

If you want this middleware to handle stylesheets under other request path you can change it like this:

use Rack::LessCss, :less_path => File.join(Merb.root, "public", "less"), :css_route => "/assets/css"

Contact & Information

Marcin Kulik - http://ku1ik.com/

License

This software is released under MIT license (see LICENSE file).

About

Rack middleware for serving LessCSS files compiled to CSS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages