Jump to content

Version control for spritesheet images using Loader pre

Rob Gordon

Recommended Posts

This is really more of a comment than a question since I needed a solution for version-controlling a spritesheet and couldn't see a straightforward way of doing it.

To version-control the json file, I do this:

var file = [{name:"ui", url:"ui.json?v=1"}]

Now, the PIXI Loader will automatically load the image file and internally append "_image" to its name...but it will *not* carry over the "?v=1" part to the url.

A solution to this problem is to use the 'pre' middleware to modify the url of the file, as follows:


function preProcessor(resource, next) {
    if (resource.name == "ui_image") {
        resource.url = resource.url.split("?")[0] + "?v=1";

I'll leave this here for further comment or as an example of a working solution to this kind of problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...