25Setting Up for a Compass Project

In the introduction to this part, we saw the simple method for using Compass via the sass --compass command. However, if you want to do more advanced things in Compass, you can set up a Compass project. If you are familiar with Rails or Drupal or other similar frameworks, you’ll be familiar with this kind of process. Compass sets up default files and folders for you to work with.

If you use another framework like Rails with Sass, you should reference how to set up a Compass project for it. If you are just using the command line (which we recommend for following along with this book), then we recommend using the method detailed on the next page.

Once you have generated your project, you can place your Sass files in the sass/ folder. If you want to change any Compass settings, feel free to edit the config.rb file. Compiled CSS is placed inside the css/ folder.

To compile a project, simply run compass compile. If you want to watch the whole project for changes, then use compass watch.

What To Do...
  • Create a project.

    This only works if you followed the compass gem install instructions found at the introduction to this part.

     
    $> compass create my_project_name

    This should print out the following:

     
    directory my_project_name/sass/
     
    directory my_project_name/style sheets/
     
    create my_project_name/config.rb
     
    create my_project_name/sass/screen.scss
     
    create my_project_name/sass/print.scss
     
    create my_project_name/sass/ie.scss
     
    create my_project_name/style sheets/ie.css
     
    create my_project_name/style sheets/print.css
     
    create my_project_name/style sheets/screen.css
     
     
    *******************************************************
     
    Congratulations! Your compass project has been created.
  • Compile the project.
     
    $> compass compile my_project_name

    This should print out the following:

     
    unchanged project/sass/ie.scss
     
    unchanged project/sass/print.scss
     
    unchanged project/sass/screen.scss

    Obviously, if you changed the files, then they would get recompiled. Try that now!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.177.14