项目作者: Yangfan2016

项目描述 :
The compressor based UglifyJS and UglifyCSS
高级语言: JavaScript
项目地址: git://github.com/Yangfan2016/yan-compressor.git
创建时间: 2018-06-07T07:03:47Z
项目社区:https://github.com/Yangfan2016/yan-compressor

开源协议:MIT License

下载


" class="reference-link">yan-compressor NPM version

The compressor based on UglifyJS and UglifyCSS

Installation

  1. $ npm install yan-compressor

API

First, create the file “json” in the root directory

  1. [
  2. // The config of js
  3. {
  4. "entry": [ // entry :string[]
  5. "./examples/libs/jquery.js",
  6. "./examples/libs/vue.js"
  7. ],
  8. "output": {
  9. "filename": "vendor.min.js",
  10. "path": "./examples/compress/js"
  11. },
  12. "sourceMap": true // make map file of js
  13. },
  14. // The config of CSS
  15. {
  16. "entry": [ // entry :string[]
  17. "./examples/css/font-awesome.css"
  18. ],
  19. "output": {
  20. "filename": "app.min.css",
  21. "path": "./examples/compress/css"
  22. },
  23. "convertRelativePath": true, // convert to relative url for source css
  24. "convertFontToBase64": { // convert font|image to base64
  25. "types": [".woff2", ".woff"],
  26. "limit": 204800
  27. }
  28. }
  29. ]

Then execute the following command

  1. $ compress

If you just want to compress part of files, execute the following command

  1. $ compress -css
  1. $ compress -js

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT license

Copyright (c) 2018 Yangfan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


built upon love by docor v0.3.0