1

sass使用CLI时如何配置 Compass ?

基本上我是设置images_dir属性,这是我一直在使用的命令:

sass 
    --compass
    path/to/input.scss
    path/to/output.css

我试过了:

sass 
    --compass
    -c path/to/config.rb
    path/to/input.scss
    path/to/output.css

输出:

WARNING on line 1 of path/to/config.rb:
This selector doesn't have any properties and will not be rendered.
Syntax error: Invalid CSS after "image_dir ": expected selector, was "= "test""
    on line 1 of path/to/config.rb

所以很明显,在使用命令-c时它的工作方式不同。compass compile

sass 
    --compass
    --images-dir path/to/images
    path/to/input.scss
    path/to/output.css

输出:

OptionParser::InvalidOption: invalid option: --images-dir

同上。

我尝试使用compass compile但我没有项目目录。

compass compile 
    --images-dir path/to/images
    path/to
    path/to/input.scss

输出:

You must compile individual stylesheets from the project directory.

也试过这个:

compass compile 
    path/to

输出:

Nothing to compile. If you're trying to start a new project, you have left off the directory argument.

config.rb 刚刚包含:

images_dir = "test"
4

1 回答 1

2

compass compile读取config.rb配置文件。

这是我使用的示例项目设置,从config.rb文件开始:

require "susy"

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/css"
sass_dir = "private/scss"
images_dir = "public/images"
http_images_path = "/images"

output_style = :expanded # or :nested or :compact or :compressed

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = true

我的项目设置如下:

private/scss    # scss files. I use a main file that handles imports itself
public/images   # images
public/css      # built css here
config.rb       # contents included above

为了构建它,我在项目的根文件夹中运行以下命令:

bundle exec compass compile private/scss/layout.scss
于 2013-02-13T01:54:40.910 回答