ステップ 1:開発構成config.rb
は次のようになります。
# Basic configuration.
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line).
# Options: ":expanded", ":nested", ":compact", ":compressed"
output_style = :expanded
# Enable debugging comments that display the original location of your selectors.
line_comments = true
# Re-compile the sass files using the minified configuration.
on_stylesheet_saved do
`compass compile -c config_minified.rb --force`
end
ステップ 2:別の構成ファイルを追加する必要があり、次のようconfig_minified.rb
になります。
# Basic configuration.
http_path = "/"
css_dir = "css/minified"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
# Compressed the output for production.
output_style = :compressed
# Disable debugging comments for production.
line_comments = false
ステップ 3:通常どおりコンパイルすれば準備完了です。
compass watch
意志は/css/minified/style.css
自動的に生成されます。
これらの手順に従うと、プロジェクトは次のようになります。
/css
/css/style.css
/css/minified/style.css
/images
/sass
/sass/style.scss
config.rb
config_minified.rb
編集
プロジェクトごとの相対パスを台無しにしたくない場合はconfig_minified.rb
、ルート フォルダーに相対的な css フォルダーを使用するために を変更できます。
# do not use the css_dir = "css/minified" because it will break the images.
css_dir = "css-minified"