Windows

Windows support is currently not available. You may find success, however, after installing node-canvas manually. Patches to add or improve Windows support are welcome.

Adding Sprites

Simply use the -shalam-sprite declaration in your CSS files:

.my-great-class{

font-size:1.5em;

font-weight:bold;

-shalam-sprite:"files-page/chevron.png" dest-size(32px32px);

}

The syntax for -shalam-sprite is simple: a string containing a path to an image asset (discussed below) is required. Following the string is an optional dest-size() modifier. dest-size() allows you to specify the height and width of the image as you would like it to appear on the page. This is usually the width and height of the element you are applying -shalam-sprite to. Only two positive non-zero numbers that use px as the unit are accepted.

Running

The first argument is the path to a directory containing the CSS files to process.

The second argument is the path to a directory containing the source images that will be used in the sprited image. This doesn't need to be a part of your application's main repository (since the source images will not be included in your assets). For example, you might keep your source images in /Users/matt/projects/site-assets/.

The third argument is the path to the location you expect the final sprited image to go. That is, if you expect to create static/img/sprite.png, you will specify static/img/sprite. The file extension is omitted intentionally to support a compatibility sprite (static/img/sprite.compat.png, for IE8 support).

For example, you might run:

shalam static/css static/img static/img/sprite

The URL paths to the sprited images that will be inserted into the CSS will be
relative to their paths on the disk. In the above example, the following code:

/* ~/myapp/static/css/main.css */

.foo{

-shalam-sprite:"image.png";

}

run with the following command:

shalam static/css static/img static/img/sprite

will yield

/* ~/myapp/static/css/main.css */

.foo{

-shalam-sprite:"image.png";

/* shalam! */;

background:url(../img/sprite.png)00;

background:url(../img/sprite.compat.png)00/40px40px;

/* end shalam */

}

Notice that the URLs used in the template are relative from the final path of the sprited image to the location of the CSS file. In static/css/main.css, ../img/sprite.png would yield static/img/sprite.png, which is what we passed for the third argument.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.