compass: You must compile individual stylesheets from the project directory

前端 未结 6 2384
有刺的猬
有刺的猬 2020-12-29 05:36

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 w

6条回答
  •  天命终不由人
    2020-12-29 05:52

    For anyone looking to compile SCSS without making a whole project (e.g., for a one-off page), you can just create a config.rb, but it needs at least two parameters: css_dir and sass_dir. (touch-ing it is not enough). A minimal config.rb:

    css_dir='.';sass_dir='.'
    

    This effectively creates a compass project for the purpose of compiling simple files. You'll have to include the rest of the params if you want to use sprites, etc. Assuming compass can write to the directory, it'll create the .sass-cache directory once you run compass compile or compass watch for the first time.

    It's also important to note that compass commands must be run from the directory with config.rb, or you'll get this error.

    Finally, if you just want to take advantage of simple SASS features (and not Compass framework components), straight SASS is often simpler:

    sass --watch foo.scss:foo.css

提交回复
热议问题