2013-02-13 59 views
1

如何在使用sass CLI时配置Compass?SCSS和Compass CLI配置

基本上我是设置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在使用时工作方式不同命令。

而且

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" 
+0

什么是你的config.rb文件? – tristanm 2013-02-13 01:32:01

+0

另外,你会得到什么输出? – tristanm 2013-02-13 01:34:17

+0

指南针有它自己的命令:'指南针手表'或'指南针创造'。试试'compass --help'获取更多选择。 – cimmanon 2013-02-13 01:34:42

回答

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