From a8a5e3fbed9aeee3a377e73480c6778fc03d4a03 Mon Sep 17 00:00:00 2001 From: syuji higa Date: Fri, 16 Oct 2015 10:02:29 +0900 Subject: [PATCH] =?UTF-8?q?spritesmith=20=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E5=8F=8D=E6=98=A0=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/gulp-stylus-sprites.js | 4 ++-- package.json | 5 +++-- src/gulp-stylus-sprites.coffee | 3 ++- test/fixtures/htdocs/images/circle.png | Bin 1171 -> 1109 bytes test/test.coffee | 4 ++++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/gulp-stylus-sprites.js b/lib/gulp-stylus-sprites.js index b16009e..5a8deaf 100644 --- a/lib/gulp-stylus-sprites.js +++ b/lib/gulp-stylus-sprites.js @@ -62,9 +62,9 @@ module.exports = function(opts) { if (!isChanged) { return; } - return spritesmith({ + return spritesmith(merge({ src: srcImageFilenames - }, (function(_this) { + }, spritesmithOpts), (function(_this) { return function(err, result) { var fileRootPath, imageFile; if (err != null) { diff --git a/package.json b/package.json index 57b379b..50cd447 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-stylus-sprites", - "version": "0.0.26", + "version": "0.0.27", "description": "gulp stylus sprite", "keywords": [ "gulpplugin", @@ -34,6 +34,7 @@ "gulp-mocha": "^1.1.1", "gulp-replace": "^0.4.0", "mocha": "^1.21.4", - "should": "^4.0.4" + "should": "^4.0.4", + "spritesmith": "^0.20.1" } } diff --git a/src/gulp-stylus-sprites.coffee b/src/gulp-stylus-sprites.coffee index d023785..81cc92d 100644 --- a/src/gulp-stylus-sprites.coffee +++ b/src/gulp-stylus-sprites.coffee @@ -62,7 +62,8 @@ module.exports = (opts = {}) -> return unless isChanged - spritesmith { src: srcImageFilenames }, (err, result) => + spritesmith merge({ src: srcImageFilenames }, spritesmithOpts), (err, result) => + throw new PluginError PLUGIN_NAME, err if err? fileRootPath = relative imgSrcBase, "#{dirGroup}.png" diff --git a/test/fixtures/htdocs/images/circle.png b/test/fixtures/htdocs/images/circle.png index a42487b301ff7afb6dac1c94c912e3314b6c1adc..0fda3c15450663de633c21fb56456a72f539387f 100644 GIT binary patch delta 1074 zcmbQtd6i>=Q9Ylhi(|;qgB!D=av2ydT=qZC)5v3`Dlv=a=tn1ZP0<)G#`ZmqUU3S} z#~ZG^k=zw!RB~Q`qeL*~PTurKLM-}ug{LmCztE34c;vo`(3g9~_dZxr-k>47T?h zyO^mTlKgg-rFgl;rb>4UQ{g4AEGEtszT(TeGI>hs@}A^iM)r(Tal-73rf*K(lgnb9 z_{W7Y^yf;pkSEK90w&E5s-LjAq4SRqlh993Cbmz;934;9`CcUJR40F7Zrd?&uQX5d z71MXA&*iQ!YYO2H-&EW>Z)L)|=IGhw-F-6?@>;x)n5iFAbxUhnzAHm{Tb<#p7gb9f zPB&TiY-o0VUD(b2XUl?&oq9rlj&YufdoCCLA|a)dN%wq(gZTar?5R1?XC>XD9F{9K+Z zYTo94{T&X>x5Kvge*e)Tt5UJS#qqQeZ_Uy4oXWkrH3y=7CPV~W*tDY4?A5jB0`CnD z&UJ5EE@k1K@>glj;)fFx^5oMya{OA1>)*`geCAh}^0}`dOU>hIp^~-wirHL2$2Cs- zNgiLu#CKuJUNt_ZtQ(W}+FoH&`q{~}>QgZ9iWB~-3smfvDx@e=fpkU zHpf>|-!~QaX9qj3YS+HG)9HMO!S#b{&+c|T?qgtnNHuA;@M9rmtmSMLYrjaf{qlj=)Mdq@rb$;=IN3Tb9>2i# ZkGYeZVNYfH{*Mem;OXk;vd$@?2>?0G^Qr&< delta 1136 zcmcc0F`09MQN53+i(|;qgZsUdD;XFby#GF1TbECVC$nkOMuF2MN-R38-Fq6l`HddW zSKm;2)7(RlBjOf^*uhh7Ea{h3r{3LGywkY6DlV*e(wUlggYAntWw&hTEnQP-=GJG; zQ{Y=+(Eh;LRa#bNL86`WmkX*fmF^$BkFxa@bj&(0`OsRAqrX1Q<4nk#hZ6A{AAJtn z(5=5DdD9)~&i@*G1x?$I-aI1qa>ko`+MV^9-wK+h9bLWH^Owi8*tE28!WA~{BDumBH}hqk3U)s3;&kzdWL@|=sZ9GMcHXDi z3F?cMTCMHKy?V1RB7E-Gj(XFpk=4>0Gn<@A?~vQoqWzxZS(wSjX0dG>`%KRtJ5kuqxQ>(m*@xMcq6hyAol*Va zv9Onq?}EX6#i|!v>-H%Bn0g2irY!xyAPu^4*l=Ic(dTOu#N(G7Gumk`lrIVm(rH&B zo&kgOI#;!Y&J&e z9_7zeUun24V7ms`5v3x`QoVHH{JVoeLk+jthq8; z=Mx=oyVQSK(>&|bl?#RwMNA6Y?oVAk?Na{@N9UhXH###``e`Rcmu^$O7MgCG^@44u5H;K1EXvY_?N4-72 zr?{_4x}5Z-P-@2)x1_cno2P8{7msuSbE`~xW3(}gyapnjHiFV=$b}<(Q8$iRU9*u^ hJ}%3)gU@EhVfl}FI;Co*9<>ZW;OXk;vd$@?2>?k57Iy#u diff --git a/test/test.coffee b/test/test.coffee index 66675af..fe199a0 100644 --- a/test/test.coffee +++ b/test/test.coffee @@ -16,6 +16,8 @@ describe 'gulp-stylus-sprite', -> isGetAllData = false stream = stylusSprites imgSrcBase: resolve __dirname, 'fixtures/sprite' + spritesmithOpts: + engine: 'pngsmith' stream.on 'data', (file) -> switch extname file.path when '.png' @@ -41,6 +43,8 @@ describe 'gulp-stylus-sprite', -> stream = stylusSprites imgSrcBase: resolve __dirname, 'fixtures/sprite' stylusFileName: 'test' + spritesmithOpts: + engine: 'pngsmith' stream.on 'data', (file) -> switch extname file.path when '.png'