Giter VIP home page Giter VIP logo

scaled-spritesmith-cli's Introduction

scaled-spritesmith-cli

Extension of spritesmith with cli capability and capability for generating css to scale images in sprite by taking in a handlebars template. Usage: In package.json

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "costar-sprite-smith --config imageSpriteConfig.js"
  }

imageSpriteConfig.js Structure:

{
    src: imageSource, // array of glob patterns
    imgDest: './content/images/go-sell-sprite.png',
    cssDest: './content/common/imageSprite.less',
    cssFormat: 'less',
    resizeConfig:  , //See Below for resizeConfig structure
    cssTemplate: './LessTemplate/Lesstemplate.handlebars',
    padding: 2,
    cssVarMap: function (sprite) {
        // add snake-case as a dependency 
        // the built in snake case does not seem to work
        sprite.name = snakeCase(sprite.name).split("_").join("-").toLowerCase();

        // changers.push(sprite);
    },
    cssHandlebarsHelpers: {
        imgPath: function (imgName) {
            return "/Content/images/" + imgName;
        },
        sourceImage: function (sourceImagePath) {
            return path.basename(sourceImagePath);
        }
    }
}

resizeConfig Structure:

{
  "google-search": [ 18, 19 ], // generates icon-google-search
  "email": {
    "default": [ 29, 19 ],
    "small": [ 26, 17 ],
    "contacts": [22,14]
  }, //generates classes icon-email-default,icon-email-small,icon-email-contacts
  "edit-icon": {
    "@": [ 15, 16 ],
    "activity": [ 19, 20 ] //geenrates classes icon-edit-icon, icon-edit-icon-activity
  }
}

scaled-spritesmith-cli's People

Contributors

vrali avatar

Watchers

 avatar  avatar  avatar

Forkers

cnxtech

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.