Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: yui/yuicompressor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Silverpeas/silverpeas-ui-compressor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 13 files changed
  • 2 contributors

Commits on Apr 10, 2019

  1. Inception of a fork of YUI Compressor.

    First step: mavenizing the project into the context of Silverpeas.
    SilverYoCha committed Apr 10, 2019
    Copy the full SHA
    36ff0cb View commit details
  2. Release 2.5

    SilverYoCha committed Apr 10, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e4e298a View commit details

Commits on May 31, 2024

  1. Add support for ?. token

    mmoqui committed May 31, 2024
    Copy the full SHA
    159dd57 View commit details
  2. Release 2.6

    mmoqui committed May 31, 2024
    Copy the full SHA
    a3ad8fe View commit details
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -14,3 +14,7 @@ build/build_tmp
build/yuicompressor*.jar
.project
.classpath
*.iml
.idea
.idea/
silverpeas-ui-compressor-*.jar
76 changes: 14 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,31 @@
YUI Compressor - The Yahoo! JavaScript and CSS Compressor
Silverpeas's UI Compressor - The Silverpeas JavaScript and CSS Compressor
=========================================================

The YUI Compressor is a JavaScript compressor which, in addition to removing
The Silverpeas's UI Compressor is a fork of YUI Compressor which is a JavaScript compressor which, in addition to removing
comments and white-spaces, obfuscates local variables using the smallest
possible variable name. This obfuscation is safe, even when using constructs
such as 'eval' or 'with' (although the compression is not optimal in those
cases) Compared to jsmin, the average savings is around 20%.
cases).

The YUI Compressor is also able to safely compress CSS files. The decision
It is also able to safely compress CSS files. The decision
on which compressor is being used is made on the file extension (js or css)

Building
--------

ant
mvn clean install

Testing
-------

./tests/suite.sh


Node.js Package
---------------

You can require compressor in a Node.js package and compress files and strings in async.
_It still uses Java under the hood_

npm i yuicompressor

```javascript

var compressor = require('yuicompressor');

compressor.compress('/path/to/file or String of JS', {
//Compressor Options:
charset: 'utf8',
type: 'js',
nomunge: true,
'line-break': 80
}, function(err, data, extra) {
//err If compressor encounters an error, it's stderr will be here
//data The compressed string, you write it out where you want it
//extra The stderr (warnings are printed here in case you want to echo them
});

```

Options:
* `charset` // defaults to 'utf8'
* `type` // defaults to 'js'
* `line-break`
* `nomunge`
* `preserve-semi`
* `disable-optimizations`


TODO
----

* Better Docs
* Help Pages

Build Status
------------

[![Build Status](https://secure.travis-ci.org/yui/yuicompressor.svg?branch=master)](http://travis-ci.org/yui/yuicompressor)


Global Options
--------------

-h, --help
Prints help on how to use the YUI Compressor
Prints help on how to use the Silverpeas's UI Compressor

--line-break
Some source control tools don't like files containing lines longer than,
@@ -89,18 +42,18 @@ Global Options
required if the input file extension is neither 'js' nor 'css'.

--charset character-set
If a supported character set is specified, the YUI Compressor will use it
If a supported character set is specified, the Silverpeas's UI Compressor will use it
to read the input file. Otherwise, it will assume that the platform's
default character set is being used. The output file is encoded using
the same character set.

-o outfile

Place output in file outfile. If not specified, the YUI Compressor will
Place output in file outfile. If not specified, the Silverpeas's UI Compressor will
default to the standard output, which you can redirect to a file.
Supports a filter syntax for expressing the output pattern when there are
multiple input files. ex:
java -jar yuicompressor.jar -o '.css$:-min.css' *.css
java -jar silverpeas-ui-compressor.jar -o '.css$:-min.css' *.css
... will minify all .css files and save them as -min.css

-v, --verbose
@@ -114,8 +67,7 @@ JavaScript Only Options

--preserve-semi
Preserve unnecessary semicolons (such as right before a '}') This option
is useful when compressed code has to be run through JSLint (which is the
case of YUI for example)
is useful when compressed code has to be run through JSLint

--disable-optimizations
Disable all the built-in micro optimizations.
@@ -127,7 +79,7 @@ Notes

* Supports wildcards for specifying multiple input files.

* The YUI Compressor requires Java version >= 1.5.
* The Silverpeas's UI Compressor requires Java version >= 1.8.

* It is possible to prevent a local variable, nested function or function
argument from being obfuscated by using "hints". A hint is a string that
@@ -152,7 +104,7 @@ The hint itself disappears from the compressed file.

* C-style comments starting with `/*!` are preserved. This is useful with
comments containing copyright/license information. As of 2.4.8, the '!'
is no longer dropped by YUICompressor. For example:
is no longer dropped by Silverpeas's UI Compressor. For example:

```
/*!
@@ -162,12 +114,12 @@ The hint itself disappears from the compressed file.
*/
```

remains in the output, untouched by YUICompressor.
remains in the output, untouched by Silverpeas's UI Compressor.

Modified Rhino Files
--------------------

YUI Compressor uses a modified version of the Rhino library
Silverpeas's UI Compressor uses a modified version of the Rhino library
(http://www.mozilla.org/rhino/) The changes were made to support
JScript conditional comments, preserved comments, unescaped slash
characters in regular expressions, and to allow for the optimization
8 changes: 0 additions & 8 deletions ant.properties

This file was deleted.

12 changes: 4 additions & 8 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="YUI Compressor" default="build.jar" basedir=".">

<target name="clean" depends="-load.properties">
<target name="clean">
<delete dir="${build.dir}" quiet="true"/>
</target>

<target name="-load.properties">
<property file="ant.properties"/>
</target>

<target name="-init" depends="-load.properties">
<target name="-init">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
@@ -33,8 +29,8 @@
deprecation="off"
debug="on"
includeantruntime="false"
target="1.5"
source="1.5">
target="1.8"
source="1.8">
<classpath>
<pathelement location="${lib.dir}/jargs-1.0.jar"/>
<pathelement location="${lib.dir}/rhino-1.7R2.jar"/>
52 changes: 0 additions & 52 deletions maven_central/build.xml

This file was deleted.

64 changes: 0 additions & 64 deletions maven_central/template/pom.xml.template

This file was deleted.

Loading