Compass notes

Notes about Compass, the CSS generator.

Compass will keep an eye on your SASS files (actually more recently your SCSS files - SCSS is the latest syntax, while SASS is older) and compile them in to CSS files on the fly, or when you ask it to.

Compile on the fly

If you are in a project directory /path/to/project, which contains ‘sass’ and ‘css’ subdirectories, then you can have CSS updated when the SCSS/SASS files change.

cd /path/to/project
compass watch

Compile on command

To compile the CSS files when asked:

cd /path/to/project
compass compile

You may need to add the --force option to have compass overwrite your existing CSS files:

compass compile --force

Gotchas

CSS not updating

If you edit a mixin or partial, then the CSS that uses them should be automatically updated. However I have had occasions when this didn’t happen for some reason.

Two workarounds:

  1. Either edit the SASS/SCSS that uses the mixin/partial, in which case compass watch will notice the edit and update the corresponding CSS.
  2. Or run compass compile --force to force recompilation of all CSS files.

References

Last modified: 29/11/2015 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top