0

コンパスを使用してスプライト シートを生成していますが、これは魔法のように引き離されます。私の問題は、div {@include folder-sprite(js);}スプライト シート全体を含む単一の png を含めようとしたときです。これを修正するにはどうすればよいですか? どんな助けでも大歓迎です、ありがとう:)

現在の不完全な実装:

    sass
    $icons-layout: horizontal;
    @import "icons/*.png";
    div {@include icons-sprite(js);}

    css
    .icons-sprite, div {
     background-image: url('../images/generated/icons-s119197eae9.png');
     background-repeat: no-repeat; }

css はスプライト シートを読み込んで自動的に利用する必要background-positionがありますが、そうではありません

編集:コンパスconfig.rb

##
## This file is only needed for Compass/Sass integration. If you are not using
## Compass, you may safely ignore or delete this file.
##
## If you'd like to learn more about Sass and Compass, see the sass/README.txt
## file for more information.
##

# Default to development if environment is not set.
saved = environment
if (environment.nil?)
  environment = :development
else
  environment = saved
end

# Location of the theme's resources.
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
generated_images_dir = images_dir + "/generated"
javascripts_dir = "js"

# Require any additional compass plugins installed on your system.
require 'compass-normalize'
require 'rgbapng'
require 'toolkit'
require 'breakpoint'
require 'singularitygs'
require 'susy'
require 'sass-globbing'

##
## You probably don't need to edit anything below this.
##

# You can select your preferred output style here (:expanded, :nested, :compact
# or :compressed).
output_style = (environment == :production) ? :expanded : :nested

# To enable relative paths to assets via compass helper functions. Since Drupal
# themes can be installed in multiple locations, we don't need to worry about
# the absolute path to the theme from the server omega.
relative_assets = true

# Output source maps in development mode.
sass_options = (environment == :production) ? {} : {:sourcemap => true}
4

1 に答える 1

0

HTML must have sprite name / sprite folder as a class, as compass outputs to that specific class. As to why all images printed, simply because I didn't set a width/height on the specified class and the whole spritesheet was output.

于 2014-10-31T06:50:03.013 に答える