2017 © Pedro Peláez
 

magento2-component grunt-sprite

Magento2 grunt sprite generation tool

image

magekey/grunt-sprite

Magento2 grunt sprite generation tool

  • Friday, May 4, 2018
  • by magekey
  • Repository
  • 1 Watchers
  • 1 Stars
  • 53 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 9 Versions
  • 121 % Grown

The README.md

Travis branch Packagist Packagist, (*1)

Magento 2 Grunt Sprite Tool

Sprite Generation for Magento 2, based on Grunt, (*2)

Installation

  1. Run composer require magekey/grunt-sprite
  2. Go to package directory cd vendor/magekey/grunt-sprite
  3. Run npm install
  4. Run grunt setup create a convenient symlink grunt-sprite and config file grunt-sprite-config.json.sample in the project root.
  5. Rename grunt-sprite-config.json.sample to grunt-sprite-config.json and define your themes

LESS Example:, (*3)

{
  "path": {
    "sprite_mytheme": "<%= project %>/app/design/frontend/Vendor/mytheme/web"
  },
  "sprite": {
    "mytheme": {
      "src": "<%= sprite_mytheme %>/images/sprite/*.png",
      "dest": "<%= sprite_mytheme %>/images/sprite.png",
      "destCss": "<%= sprite_mytheme %>/css/source/_sprite.less"
    }
  }
}

SCSS Example:, (*4)

{
  "path": {
    "sprite_mymodule": "<%= project %>/app/design/frontend/Vendor/mytheme"
  },
  "sprite": {
    "test_module": {
      "src": "<%= sprite_mymodule %>/MyPackage_Module/web/images/sprite/*.png",
      "dest": "<%= sprite_mymodule %>/MyPackage_Module/web/images/sprite.png",
      "destCss": "<%= sprite_mymodule %>/MyPackage_Module/web/scss/_sprite.scss",
      "cssTemplate": "<%= src %>/templates/scss.template.handlebars"
    }
  }
}

Usage

cd grunt-sprite
grunt sprite:<sprite>

Add sprites to your theme in app/design/Vendor/theme/web/css/_styles.less, (*5)

@import 'source/lib/_lib.less'; // Global lib
@import 'source/_sources.less'; // Theme styles
@import 'source/_components.less'; // Components styles (modal/sliding panel)

// Add new line to import sprites
@import 'source/_sprite.less'; // Sprites

The Versions

04/05 2018

dev-master

9999999-dev

Magento2 grunt sprite generation tool

  Sources   Download

MIT

05/04 2018

1.1.3

1.1.3.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

03/04 2018

1.1.2

1.1.2.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

24/12 2017

dev-add-code-of-conduct-1

dev-add-code-of-conduct-1

Magento2 grunt sprite generation tool

  Sources   Download

MIT

04/12 2017

1.0.4

1.0.4.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

24/11 2017

1.0.3

1.0.3.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

24/11 2017

1.0.2

1.0.2.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

24/11 2017

1.0.1

1.0.1.0

Magento2 grunt sprite generation tool

  Sources   Download

MIT

24/11 2017

1.0.0

1.0.0.0

Magento2 grunt sprite modules dependencies for local development

  Sources   Download

MIT