Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compass: You must compile individual stylesheets from the project directory

Tags:

A while ago I was using compass to generate stylesheets from sass for a project.

Recently I returned to that project. I went to my sass directory and did "compass watch --debug .:." This generated the error "You must compile individual stylesheets from the project directory".

I discovered that there was no config.rb in the directory. So I recreated one. It looks like this:

http_path = "/" css_dir = "/css" sass_dir = "/css" images_dir = "/img" javascripts_dir = "/js" preferred_syntax = :sass 

However, all of my attempts to use compass result in the same error, no matter what values I put in the config.

How do I get compass to actually process my sass?

like image 421
davedave Avatar asked Oct 17 '13 05:10

davedave


2 Answers

just came across this problem too, and it has already been answered in the comment by Arnaud Valle. But just for clarity, and people later searching.

Just creating a config.rb will not work, as compass does not recognise it. The answer is just switch to your project directory(root) and then run

compass init 

This will then create you a "working" config.rb, and two directories called sass, and stylesheets, in the sass directory will be a couple of start scss files.

If you do not want them, or want to use different directories, you can of course now edit your freshly created and working config.rb, and change your directories (and then delete the old automatically created ones)

Oh and i suspect your js will not be in a folder javascripts, so edit that to in the config.rb

Anyway having done that(or not) you should then be able to run

compass watch 

and all should be good , i.e. your scss files get compiled to css files

As an alternative that I have not tried, but theoretically

compass compile [path/to/scss] 

should work too, if you don't want to init compass

More information to be found in the compass documentation here

and to go completely over the top, if this is something you find yourself doing often, and hate the defaults then edit/add the following to your ~/.bash_profile

alias compass_init="compass init --syntax=sass --css-dir=css --javascripts-dir=js" 
like image 127
John Smith Avatar answered Nov 25 '22 11:11

John Smith


I usually have my config.rb in my project directory (or root) rather than the sass directory.

Folder structure would be like this:

  • config.rb
  • --- css
  • --- sass

Also your css_dir and sass_dir have the same value, which could lead to your issue as well.

like image 41
Arnaud Valle Avatar answered Nov 25 '22 12:11

Arnaud Valle