Coder Social home page Coder Social logo

spritesmith-cli's Introduction

spritesmith-cli

Adds a CLI to the spritesmith module

Spritesmith is awesome but sometimes we don't want to run it through Grunt.

Install

npm install -D spritesmith-cli

Usage

spritesmith [options]

These are the options you can set on the CLI.

Option Description
--rc Point to a different .spritesmith.js configuration file

The default configuration file used will be .spritesmith.js at the current working directory (process.cwd()). This file should export a few properties. Note that you can export either a single object or an array. If you use an array you'll be able to create multiple spritesheets in one shot.

Examples:

'use strict';

var util = require('util');

module.exports = {
  src: './client/img/icons/**/*.{png,gif,jpg}',
  destImage: '.bin/public/img/icons.png',
  destCSS: 'client/css/generated/icons.css',
  imgPath: '/img/icons.png',
  padding: 2,
  algorithm: 'top-down',
  algorithmOpts: { sort: false },
  engine: 'gmsmith',
  cssOpts: {
    cssClass: function (item) {
      return util.format('.ic-%s:before', item.name);
    }
  }
};
'use strict';

var util = require('util');

module.exports = [{
  src: './client/img/icons/**/*.{png,gif,jpg}',
  destImage: '.bin/public/img/icons.png',
  destCSS: 'client/css/generated/icons.css',
  imgPath: '/img/icons.png',
  cssOpts: {
    cssClass: function (item) {
      return util.format('.ic-%s:before', item.name);
    }
  }
}, {
  src: './client/img/markdown-editor/**/*.{png,gif,jpg}',
  destImage: '.bin/public/img/markdown-editor.png',
  destCSS: 'client/css/generated/markdown-editor.styl',
  imgPath: '/img/markdown-editor.png',
  cssOpts: {
    cssClass: function (item) {
      return util.format('.pm-%s:before', item.name);
    }
  }
}];

Note that src can be either a globbing pattern or an array of globbing patterns, it'll be passed straight to multi-glob.

The destImage and destCSS properties are optional and can be omitted. That means that you can create only one file depending on your needs.

That's about it. For configuration information please refer to the grunt-spritesmith and spritesmith packages.

License

MIT

spritesmith-cli's People

Contributors

balthazar avatar bevacqua avatar martinheidegger avatar

Watchers

 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.