Getting started with Compass
Compass is an open-source CSS authoring framework which uses the Sass stylesheet language to make writing stylesheets powerful and easy. If you're not familiar with Sass, Go to sass-lang.com to learn all about how it works.
Installing Compass
To install, please follow the steps found in the Compass installation guide.
This will install Compass and Sass too. If you want to verify that compass is installed, run:
$ compass version
Watching and Compiling your Project
When doing development on your project, you can run the compass watcher to keep your CSS files up to date as changes are made.
$ cd /path/to/project
$ compass watch
When it comes time to compile your css files for production use, pass the --production
compiler option to select defaults that optimize your output for end-users:
$ compass compile --production
Using Compass without the command line tools
You can use compass without the compass command line tools. In some cases, this may make it easier to integrate with sass-based compilers and frameworks that do not explicitly support Compass.
$ gem install compass-core
$ cat <<- EOF > _project-setup.scss
\$project-path: absolute-path(join-file-segments(".."));
@import "compass/configuration";
\$compass-options: (http_path: "/");
@include compass-configuration(\$compass-options);
EOF
# Add to the top of each sass file: @import "project-setup";
# Compile using the Sass command line:
$ sass -r compass-core --update sass:css
Read more: Compass's Sass-based configuration options.
More command line options
Full documentation of all compass commands can be found by running:
$ compass help
To see the options available and description for a compass command run:
$ compass help <command>
Where <command>
is one of the compass commands (E.g. compile
)