UNPKG

image-magic

Version:

图片处理组件,提供自动合并雪碧图、压缩图片大小、尺寸缩放等方法。

27 lines (22 loc) 681 B
#!/usr/bin/env node var os = require('os'); var spawn = require('child_process').spawn; var platform = os.platform(); if(platform == 'linux'){ console.warn('请手动安装images@2.1.8 \n\tnpm install images@2.1.8'); run('npm install images@2.1.8',{ cwd: require('path').resolve(__dirname, '../..') }) }else{ // run('npm' + (platform == 'win32' ? '.cmd' : '') + ' install images',{ // cwd: require('path').resolve(__dirname, '../..') // }) } function run(command, opt) { var parts = command.split(/\s+/); var cmd = parts[0]; var args = parts.slice(1); opt = opt || {}; opt.stdio = 'inherit'; spawn(cmd, args, opt); }