Giter Site home page Giter Site logo

spriter's Introduction

What this is:

It analyzes an html page, looks for images, then substitutes them with divs that render the appropriate portion of a sprite that contains the original images.

The purpose is to have only one request per page for all the images on that page.

How do I hope to achieve this:

  • Page is generated by whatever backend there is and sent back to apache as a response.

  • Before Apache passes on the response to the client, a filter intercepts the response and does some analysis and transformations on the HTML source:

    • Replace all <img> tags with <div> tags with a uniquely named class attached to it.
    • Construct a mapping from the class of each <div> that replaced an <img> tag to the original URL of respective image.
    • Generate CSS to populate <div> tags with original images cut out from a generated sprite. The generated sprite is assumed to be a column stacking of all the original images.
    • A request to any image is mapped by Apache to a controller that serves the generated sprite from the original image URLs.
  • Browser ends up sending only one request for all the images.

  • Images end up being rendered just as if they have been if they were still in image tags.

spriter's People

Contributors

satiani avatar

Stargazers

 avatar Mark S. Weiss avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.