Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:38:09+00:00 2026-05-29T23:38:09+00:00

Is there a way to get compass to generate a sprite sheet from images

  • 0

Is there a way to get compass to generate a sprite sheet from images across different style sheets?

The tutorial talks about generating sprites from a bunch of images in the folder and then using it in 1 style sheet. But to me, it seems counter intuitive to have to use the following in all my stylesheets that uses the sprite sheet:

@import "icon/*.png";
@include all-icon-sprites;

I would prefer to have different images set for each sprite sheet, and then some how mark them for sprite generation so that compass can collect them into a sprite and then update the css to reflect that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:38:13+00:00Added an answer on May 29, 2026 at 11:38 pm

    Compass only generates one sprite per directory. That’s good because it can be cached by browsers eliminating the need to fetch it if you use it on multiple pages. You can use that sprite over and over even selectively using Selector Control which is covered in the tutorial you referenced.

    Imagine that in your image folder there are four icons:

    • images/icon/apple.png
    • images/icon/banana.png
    • images/icon/basketball.png
    • images/icon/football.png

    In a stylesheet called fruits.sass, you import all the icons and only use the apple and banana icons.

    @import "icon/*.png";
    
    .fruits
      .banana
        +icon-sprite(banana)
      .apple
        +icon-sprite(apple)
    

    In a stylesheet called sports.sass, you import all the icons and only use basketball and football icons.

    @import "icon/*.png";
    
    .sports
      .football
        +icon-sprite(football)
      .basketball
        +icon-sprite(basketball)
    

    When you compile, one sprite named something like icon-sjargon1.png will be generated in images.

    • images/icon/apple.png
    • images/icon/banana.png
    • images/icon/basketball.png
    • images/icon/football.png
    • images/icon-sjargon1.png

    Your generated fruits.css will look something like:

    .icon-sprite,
    .fruits .banana,
    .fruits .apple { background: url('/images/icon-sjargon1.png') no-repeat; }
    
    .fruits .banana { background-position: 0 -20px; }
    .fruits .apple { background-position: 0 0; }
    

    Your generated sports.css will look like:

    .icon-sprite,
    .sports .football,
    .sports .basketball { background: url('/images/icon-sjargon1.png') no-repeat; }
    
    .sports .football { background-position: 0 -60px; }
    .sports .basketball { background-position: 0 -40px; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there way how to get name ov event from Lambda expression like with
Is there any way to get the effect of running python -u from within
Is there any way to get a predefined element with with compass(CSS Framework)? Let's
Is there a way to get the count of different facets in solr? This
Is there a way to get the text from a java.util.regex.Matcher? It seems to
Is there any way to get the column names from the pymssql results? If
Is there a way to get emails from built-in Android email application. If so,
Greetings , Is there any way to get values from web.xml context-param into Spring
Is there a way to get stored procedures from a SQL Server 2005 Express
Is there any way to GET the ContentValues object from the SQLite? It's very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.