Posted almost 9 years ago. Visible to the public.

Speed up response time in development after a Sass change

When working with large Sass files you will notice that the first request after a change to a Sass file takes quite some time. This is because the CSS files are being generated from the Sass files the moment the application answers your request (Sass looks at the files and recompiles if the timestamp changed); it takes even longer when you build sprites with the Lemonade gem.

To avoid this, have Sass watch the files for changes and compile them into CSS files immediately. The files will be created while you are still on something else, allowing the first request to be served without a Sass compile.

  • For plain Sass (no lemonade) run the following from your project directory:
    sass –watch public/stylesheets/sass:public/stylesheets
    That keeps an eye on all .sass files inside public/stylesheets/sass (and subdirectories) and compiles them into their corresponding CSS files inside public/stylesheets.

  • When your project uses Lemonade just call:
    compass watch

When using the latter you do not need to sass --watch explicitly as compass does that already.

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Arne Hartherz
Last edit:
almost 3 years ago
development, environment
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more