• Stars
    star
    152
  • Rank 237,174 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 11 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

UglifyJS Wrapper with YUI default configs

yUglify

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

Build Status

Build Status

CLI Usage

npm -g install yuglify

yuglify has a very simple CLI interface to allow you to compress files from the command line.

yuglify ./lib/*.js #uses shell globbing, won't work on Windows

This will read all passed files and compress them (js or css) and write them back beside the original with the name altered to .min.js|css.

Required

npm install yuglify
var yuglify = require('yuglify');

yuglify.jsmin('<string of source', function(err, smashed) {
    fs.writeFile('/path/to/file', smashed, 'utf8', function() {});
});

yuglify.cssmin('<string of source', function(err, smashed) {
    fs.writeFile('/path/to/file', smashed, 'utf8', function() {});
});

Purpose

This module is primarily designed to be used inside shifter.

Why not use the default Uglify?

We need to support the /*! license comment blocks when minifying, so we added a preprocessor to the code to pull them from the source, then place them back when the minification is complete.

We also needed to make sure that the file ends in a clean line ending for our combo servers. This way we ensure that other modules don't have to end with a semi-colon and the combohandler doesn't concat them together in a bad way.

We've also added support to add a semi-colon if the last character of the minified source is either a ) or a }.

The last thing this module does is provide the default config that we think is the most compatible with the way that YUI Compressor used to minify our files.

{
    mangle: true,
    squeeze: true,
    semicolon: false,
    lift_vars: false,
    mangle_toplevel: true,
    no_mangle_functions: true,
    max_line_length: 6000
}

Testing

Currently, the tests for this module are just to make sure that they are exported properly. Shifter's test suite validates that these compressors are working as expected. Soon, we'll move them over to this repo too.

More Repositories

1

yui3

A library for building richly interactive web applications.
JavaScript
4,118
star
2

yuicompressor

YUI Compressor
Java
3,010
star
3

yuidoc

YUI Javascript Documentation Tool
HTML
893
star
4

yeti

Yeti automates browser testing.
JavaScript
386
star
5

yui3-gallery

YUI3 Gallery Modules
JavaScript
333
star
6

yui2

YUI 2.x Source Tree
JavaScript
280
star
7

builder

DEPRECATED - YUI Build Tool
JavaScript
131
star
8

yuitest

YUI Test
Java
117
star
9

phploader

Server side PHP loader for YUI files
PHP
90
star
10

nodejs-yui3

Running YUI3 on NodeJS
JavaScript
85
star
11

shifter

New YUI build tool based on Gearjs, so let's shift some gears
JavaScript
75
star
12

gridbuilder

A little web app that generates responsive YUI Grids CSS
JavaScript
54
star
13

grover

YUITest wrapper for PhantomJS
JavaScript
45
star
14

yogi

Command Line Helper for YUI
JavaScript
31
star
15

skinbuilder

A tool for creating skins for YUI widgets
JavaScript
30
star
16

2in3

Repository for the 2in3 project source
JavaScript
20
star
17

yui-lint

Default JSlint rules used by YUI in it's various packages
14
star
18

editor-extras

A collection of text editor syntax files and other extras for working with YUI.
Vim Script
12
star
19

yui3-swfs

SWF-based functionality for https://github.com/yui/yui3.
ActionScript
7
star
20

grunt-yui-contrib

YUI Build Tasks
JavaScript
6
star
21

yui-assets

A simple place to locate YUI graphics assets for public use in talks, presentations or other media usage.
6
star
22

grifter

YUI module stealer/packager
JavaScript
4
star
23

yui.github.com

yui.github.com
2
star
24

Sights

A native Win8 app built using YUI3
JavaScript
1
star
25

metrotester

A native Windows 8 App that runs YUI unit tests.
JavaScript
1
star