2017-05-25 84 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