Adds grunt-spritesmith task for any M2 theme.
First you to add new dependency to your package.json
npm install grunt-spritesmith --save-dev
Than copy dev/tools/grunt/configs/sprite.js
and dev/tools/grunt/tasks/sprite.js
to the same directories in your Magento2 installation and open Gruntfile.js
in the root directory and find something like:
[
taskDir + '/static',
'time-grunt'
].forEach(function (task) {
require(task)(grunt);
});
And type following before time-grunt
:
taskDir + '/sprite', // Here is our custom sprite task
Sprite task is ready for any theme which is defined at dev/tools/grunt/configs/themes.js
. Before using sprite task don't forget to run php bin/magento setup:static-content:deploy
Now you can run sprite task for any theme like this:
grunt sprite:<theme_name>
MIT