webpack-spritesmith
Version:
Webpack plugin that converts set of images into a spritesheet and SASS/LESS/Stylus mixins
13 lines (10 loc) • 327 B
JavaScript
;
const loaderUtils = require('loader-utils');
const path = require('path').posix;
module.exports = (fullName, spritesmithResult) => {
const parsed = path.parse(fullName);
parsed.base = loaderUtils.interpolateName({}, parsed.base, {
content: spritesmithResult.image
});
return path.format(parsed);
};