X

將 YUI Compressor 換成 yUglify - 2012

YUI Compressor 是壓縮 JavaScript、CSS 的程式, 但是看起來已經不維護了(詳見: State of YUI Compressor), 建議改成使用 yUglify 這套來繼續使用.

  • yUglify: yuglify is a wrapper around UglifyJS and cssmin with the default YUI configurations on each of them.

yUglify 安裝

  • npm -g install yuglify # /usr/local/lib/node_modules/yuglify
  • # 執行檔: /usr/local/bin/yuglify, /usr/local/lib/node_modules/yuglify/bin/yuglify

yUglify 使用

  • yuglify ./lib/*.js
  • yuglify ./foo/foo.js ./bar/bar.js #Auto saves to ./foo/foo-min.js and ./bar/bar-min.js
  • yuglify ./foo/foo.css ./bar/bar.js #Auto saves to ./foo/foo-min.css and ./bar/bar-min.js

yUglify 操作範例

  • yuglify index.js # 會產生 index-min.js
  • yuglify index.css # 或 yuglify --type css index.css 會產生 index-min.css

相關網頁

  • mishoo / UglifyJS2 - JavaScript parser / mangler / compressor / beautifier toolkit
  • mishoo / UglifyJS - JavaScript parser / mangler / compressor / beautifier library for NodeJS
Tsung: 對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
Related Post