I have done compass create .
and compass init rails
whilst in my project directory. A few questions:
.sass
files in public/stylesheets
. Is this the right place to put them?compass watch
, it does not automatically compile these .sass
files. I have to manually specify the files: compass watch public/stylesheets/myfile.sass
etc. How do I get this working automatically?ie.css
, print.css
and screen.css
have been placed in stylesheets/compiled
. How do I remove these without them reappeareing after compilation?.sass
files are compiled to compiled/ts
. Why are they in ts
and not in compiled
?Many thanks in advance
Edit: Worked it out:
app/stylesheets/
app/stylesheets/
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 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With