How does 'compass watch' work/how is it used with rails
I have done compass create .
and compass init rails
whilst in my project directory. A few questions:
- I have placed my
.sass
files inpublic/stylesheets
. Is this the right place to put them? - When I run
compass watch
, it does not automatically compile these.sass
files. I have to manually specify the files:compass wat开发者_如何学运维ch public/stylesheets/myfile.sass
etc. How do I get this working automatically? - The files
ie.css
,print.css
andscreen.css
have been placed instylesheets/compiled
. How do I remove these without them reappeareing after compilation? - My own compiled
.sass
files are compiled tocompiled/ts
. Why are they ints
and not incompiled
?
Many thanks in advance
Edit: Worked it out:
- No, put them in
app/stylesheets/
- Works if you follow above
- Remove them from
app/stylesheets/
- Do first answer and they will be put in
compiled/
Compass uses a configuration file located in "config/compass.rb" which tells it where the important directories are. I think it knows to look in config/compass.rb because it searches a list of predefined directories for a compass.rb config file
Heres the config file I use for my Rails 3 projects
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
images_dir = "public/images"
environment = Compass::AppIntegration::Rails.env
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
preferred_syntax = :sass
I generate this file by running the following command from the Rails root:
compass init rails --css-dir=public/stylesheets --sass-dir=app/stylesheets --images-dir=public/images -x sass --using blueprint/basic
This is the only command that I use to run compass, and I run it when generating my project through a rails template https://github.com/sid137/rails-templates/blob/master/rails3.rb . I constructed this command by reading through the compass help, and looking online, as I wanted to customize all of my compass setup. Now, I can immediately begin my projects with
compass watch .
or
compass compile .
精彩评论