├── .gitignore ├── .npmignore ├── README.md ├── index.js ├── package.json └── LICENSE.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | node_modules/ 3 | 4 | .DS_Store 5 | *.db 6 | *.bak 7 | *.tmp 8 | *.cmd 9 | ~* 10 | 11 | upload.py -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.settings 3 | /.project 4 | /.gitignore 5 | /node_modules 6 | /test 7 | /.tmp 8 | 9 | .DS_Store 10 | 11 | *.db 12 | *.bak 13 | *.tmp 14 | *.cmd 15 | ~* 16 | 17 | upload.py -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fis-optimizer-pngcrush 2 | 3 | A optimizer plugin for fis to compress png using pngcrush. 4 | 5 | ## usage 6 | 7 | $ npm install -g fis-optimizer-pngcrush 8 | $ vi path/to/project/fis-conf.js 9 | 10 | ```javascript 11 | //file : path/to/project/fis-conf.js 12 | fis.config.merge({ 13 | modules : { 14 | optimizer : { 15 | png : 'pngcrush' 16 | } 17 | } 18 | }); 19 | ``` 20 | 21 | $ fis release --optimizer --dest ../output -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * fis 3 | * http://fis.baidu.com/ 4 | */ 5 | 6 | 'use strict'; 7 | 8 | try { 9 | var C = require('node-pngcrush'); 10 | } catch(e){ 11 | fis.log.warning('node-pngcrush does not support your node ' + process.version + 12 | ', report it to https://github.com/xiangshouding/node-pngcrush/issues'); 13 | } 14 | 15 | module.exports = function(content, file, conf) { 16 | if (C && C.compress) { 17 | return C.option(conf).compress(content); 18 | } else { 19 | return content; 20 | } 21 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fis-optimizer-pngcrush", 3 | "version": "0.0.6", 4 | "description": "pngcrush on fis", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/fis-dev/fis-optimizer-pngcrush.git" 12 | }, 13 | "keywords": [ "fis", "pngcrush", "node-pngcrush", "png", "image" ], 14 | "dependencies": { 15 | "node-pngcrush": "0.0.8" 16 | }, 17 | "author": "xiangshouding ", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/fis-dev/fis-optimizer-pngcrush/issues" 21 | } 22 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 baidu.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------