Skip to content

Instantly share code, notes, and snippets.

@tbogin
Last active September 21, 2016 20:29
Show Gist options
  • Save tbogin/e06c450e83e3efe7bf9180b6b6cf9e8f to your computer and use it in GitHub Desktop.
Save tbogin/e06c450e83e3efe7bf9180b6b6cf9e8f to your computer and use it in GitHub Desktop.
Compass Gem - getting started

##Compass gem - getting started ###The Compass gem provides an easy way to compile .scss files into .css ####Since browsers currently only read .css files, .scss must be compiled to raw CSS before it can be viewed on a screen

##Install Compass

  1. If you have Ruby on your computer, run $gem install compass anywhere on the command line
  2. That's it!

##Set up a new project with Compass

  1. $compass create directoryName
  • running this command will create a new root directory named directoryName
  • directoryName installs with several corresponding .scss and .css files
  • To initialize Compass within an existing project, run $compass init rails directoryName
  1. Create an .html file, preferrably under the root directory
  2. Write your Sass in the screen.scss file provided by Compass, above @import "compass/reset";

##Compile Sass to CSS

  1. While in your Compass-initiated project, run $compass watch, which will track changes to your .scss files
  • Any change in screen.scss will automatically be compiled to screen.css, located within your CSS directory
  • control C in your terminal when your watch has ended
  1. To compile Sass to CSS manually, run $compass compile whenever you want to compile to CSS

##If your Compass project isn't working for some reason When I init a Compass project, the href in my stylesheet link tags start with a /, which stops the stylesheet from linking properly

  • Try removing that / from your stylesheet <link> if your Sass isn't compiling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment