![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
grunt-montage
Advanced tools
Generate CSS sprite sheets and the corresponding stylesheet
This plugin requires Grunt 0.4 or later and depends upon the montage
command line tool bundled with ImageMagick. If you don't already have it (and you're running on *nix/Mac OS), it will be automatically installed.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-montage --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks("grunt-montage");
In your project's Gruntfile, add a section named montage
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
montage: {
targetName: {
// Target-specific montage configuration
}
}
});
Type: Number
Default value: 16
The width/height of each image included in the sprite sheet.
Type: String
Default value: ".montage"
A CSS selector to prefix all sprite classes with.
Type: String
Default value: "montage.png"
The name of the generated sprite sheet image.
Type: String
Default value: "montage.css"
The name of the generated stylesheet.
Type: Object
Default value: undefined
A map of command-line options for the ImageMagick montage tool.
In this example, the default options are used to do generate a sprite sheet from 16x16 pixel versions of all the .png
files in the images/icons
directory. The sprite sheet will be created at assets/sprites/montage.css
and the image at assets/sprites/montage.png
, based on the default option values listed above.
grunt.initConfig({
montage: {
simple: {
files: {
"assets/sprites": [
"images/icons/*.png"
]
}
}
}
});
In this example, custom options are used to configure the output. It will generate a sprite sheet of 32x32 pixel images at assets/sprites/sprites.png
and the corresponding stylesheet at assets/sprites/styles.css
.
grunt.initConfig({
montage: {
simple: {
files: {
"assets/sprites": [
"images/icons/*.png"
]
},
options: {
size: 32,
outputImage: "sprites.png",
outputStylesheet: "styles.css"
}
}
}
});
In this example, custom options are used to pass extra configuration through to ImageMagick. It will generate the same sprite sheet as the previous example, but with a transparent background.
grunt.initConfig({
montage: {
simple: {
files: {
"assets/sprites": [
"images/icons/*.png"
]
},
options: {
size: 32,
outputImage: "sprites.png",
outputStylesheet: "styles.css",
magick: {
background: "none"
}
}
}
}
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Grunt Montage is released under the MIT license as detailed in the LICENSE file that should be distributed with this library; the source code is freely available.
Grunt Montage was developed by James Allardice during work on White Label Dating, while employed by Global Personals Ltd. Global Personals Ltd have kindly agreed to the extraction and release of this software under the license terms above.
FAQs
Generate CSS sprite sheets and the corresponding stylesheet
The npm package grunt-montage receives a total of 14 weekly downloads. As such, grunt-montage popularity was classified as not popular.
We found that grunt-montage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.