Sass 如何使用Compass生成css的单个缩小文件?

Sass 如何使用Compass生成css的单个缩小文件?,sass,compass,Sass,Compass,我想在project中将我的sass文件编译成单个缩小css。使用sass缩小 在命令行中,输入以下内容: $ sass --watch style.scss:style.css --style compressed # Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets

我想在project中将我的sass文件编译成单个缩小css。

使用sass缩小 在命令行中,输入以下内容:

$ sass --watch style.scss:style.css --style compressed
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"

# You can select your preferred output style here (can be overridden via the command line):
output_style = :compressed # :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

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


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
使用指南针缩小 首先,通过在命令行中输入以下命令,确保已在Compass中设置项目:

$ compass create path/to/your_project
之后,您会注意到Compass在您的项目目录中创建了两个文件夹/sass/和/样式表/。它还创建了一个config.rb文件

打开config.rb文件,您会看到一些类似于以下内容的内容:

$ sass --watch style.scss:style.css --style compressed
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"

# You can select your preferred output style here (can be overridden via the command line):
output_style = :compressed # :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

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


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
在config.rb文件中,第11行可能会用#符号注释掉。取消注释output_样式行,使其与上面的示例类似

最后,您需要让Compass开始监视对scss文件的更改。在命令行中,输入:

$ cd /path/to/your_project
$ compass watch
说完



如果你能把答案也投上一票,那就太酷了!谢谢!:)