2017-05-25 80 views
0

我很累,将scss模块手动一个接一个地转换为css。我只是想从许多模块转换我的个人scss文件。我正在使用基于命令行的罗盘观看编译css通过红宝石在铁路上服务来自指南针。 在这里你可以看到我如何管理scss到css转换通过ror clicli compass watch使用罗盘手表将单个scss文件转换为css

回答

1

您可以创建scss or sass文件,您将在其中导入所有部分。

例如:创建sass文件在您的sass目录中,如果您想要,可能是app.sass

里面app.sass进口所有你的谐音,像这样@import 'partials/button-actions'

创建目录config.rb,你开始守望者。我更喜欢使用项目根目录。
config.rb插入:

require 'compass/import-once/activate' 
# Require any additional compass plugins here. 

# Set this to the root of your project when deployed: 
# Change paths to yours. css_dir is css output directory, sass_dir is your sass file directory 
http_path = "/" 
css_dir = "css" 
sass_dir = "sass" 
images_dir = "i" 
javascripts_dir = "js" 

# You can select your preferred output style here (can be overridden via the command line): 
# output_style = :expanded or :nested or :compact or :compressed 
output_style = :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 

并开始守望者。 Yoy将得到app.css文件,其中包含来自导入文件的所有代码作为结果。将其导入您的HTML

+0

已经在使用此方法。我说我不想转换整个项目我只是想从项目转换任何单个文件 – Muzamil301

+1

@ Muzamil301重命名你的部分文件从'_button-action.scss'到'button-action.scss' – vladja

+0

感谢兄弟的工作,但忽略所有变量:-) – Muzamil301