首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SCSS和Compass CLI配置

SCSS和Compass CLI配置
EN

Stack Overflow用户
提问于 2013-02-13 08:09:10
回答 1查看 2.8K关注 0票数 1

使用sass命令行界面时如何配置指南针?

基本上,我要设置images_dir属性,下面是我一直使用的命令:

代码语言:javascript
复制
sass 
    --compass
    path/to/input.scss
    path/to/output.css

我试过了:

代码语言:javascript
复制
sass 
    --compass
    -c path/to/config.rb
    path/to/input.scss
    path/to/output.css

输出:

代码语言:javascript
复制
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

因此,在使用compass compile命令时,显然-c的工作方式不同。

代码语言:javascript
复制
sass 
    --compass
    --images-dir path/to/images
    path/to/input.scss
    path/to/output.css

输出:

代码语言:javascript
复制
OptionParser::InvalidOption: invalid option: --images-dir

如上所述。

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

代码语言:javascript
复制
compass compile 
    --images-dir path/to/images
    path/to
    path/to/input.scss

输出:

代码语言:javascript
复制
You must compile individual stylesheets from the project directory.

我也尝试了一下:

代码语言:javascript
复制
compass compile 
    path/to

输出:

代码语言:javascript
复制
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.

config.rb刚刚包含:

代码语言:javascript
复制
images_dir = "test"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-13 09:54:41

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

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

代码语言:javascript
复制
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

我的项目设置如下:

代码语言:javascript
复制
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

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

代码语言:javascript
复制
bundle exec compass compile private/scss/layout.scss
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14844263

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档