uglifycss

Port of YUI CSS Compressor to NodeJS

uglifycss downloads uglifycss version uglifycss license

uglifycss유사 패키지:
npm 다운로드 트렌드
3 년
🌟 uglifycss의 README.md에 실시간 사용 차트를 표시하려면 아래 코드를 복사하세요.
## Usage Trend
[![Usage Trend of uglifycss](https://npm-compare.com/img/npm-trend/THREE_YEARS/uglifycss.png)](https://npm-compare.com/uglifycss#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 uglifycss의 README.md에 GitHub Stars 트렌드 차트를 표시하려면 아래 코드를 복사하세요.
## GitHub Stars Trend
[![GitHub Stars Trend of uglifycss](https://npm-compare.com/img/github-trend/uglifycss.png)](https://npm-compare.com/uglifycss)
통계 세부사항
패키지
다운로드
Stars
크기
Issues
발행일
라이선스
uglifycss62,739281-108年前MIT
uglifycss의 README

UglifyCSS is a port of YUI Compressor to NodeJS for its CSS part. Its name is a reference to the awesome UglifyJS but UglifyCSS is not a CSS parser. Like YUI CSS Compressor, it applies many regexp replacements. Note that a port to JavaScript is also available in the YUI Compressor repository.

UglifyCSS passes successfully the test suite of YUI compressor CSS.

Be sure to submit valid CSS to UglifyCSS or you could get weird results.

Installation

For a command line usage:

$ npm install uglifycss -g

For API usage:

$ npm install uglifycss

From Github:

$ git clone git://github.com/fmarcia/UglifyCSS.git

Command line

$ uglifycss [options] [filename] [...] > output

Options:

  • --max-line-len n adds a newline (approx.) every n characters; 0 means no newline and is the default value
  • --expand-vars expands variables; by default, @variables blocks are preserved and var(x)s are not expanded
  • --ugly-comments removes newlines within preserved comments; by default, newlines are preserved
  • --cute-comments preserves newlines within and around preserved comments
  • --convert-urls d converts relative urls using the d directory as location target
  • --debug prints full error stack on error
  • --output f puts the result in f file

If no file name is specified, input is read from stdin.

API

2 functions are provided:

  • processString( content, options ) to process a given string
  • processFiles( [ filename1, ... ], options ) to process the concatenation of given files

Options are identical to the command line:

  • <int> maxLineLen for --max-line-len n
  • <bool> expandVars for --expand-vars
  • <bool> uglyComments for --ugly-comments
  • <bool> cuteComments for --cute-comments
  • <string> convertUrls for --convert-urls d
  • <bool> debug for --debug

Both functions return uglified css.

Example

var uglifycss = require('uglifycss');

var uglified = uglifycss.processFiles(
    [ 'file1', 'file2' ],
    { maxLineLen: 500, expandVars: true }
);

console.log(uglified);

License

UglifyCSS is MIT licensed.