Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rspivak committed May 9, 2011
1 parent 40931ce commit 7126c61
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 11 deletions.
50 changes: 44 additions & 6 deletions README.rst
@@ -1,11 +1,48 @@
Welcome to SlimIt
==================================

`SlimIt` is a Python library that parses JavaScript and returns AST.

At version `0.2` it includes a JavaScript parser, lexer, pretty
printer and a tree visitor.

`SlimIt` is a JavaScript minifier written in Python.
It compiles JavaScript into more compact code so that it downloads
and runs faster.

`SlimIt` also provides a library that includes a JavaScript parser,
lexer, pretty printer and a tree visitor.

Let's minify some code
----------------------

From the command line:

$ slimit -h
Usage: slimit [input file]

If no input file is provided STDIN is used by default.
Minified JavaScript code is printed to STDOUT.

$ cat test.js
var a = function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
};
$
$ slimit < test.js
var a=function(obj){for(var name in obj){return false;}return true;};

Or using library API:

>>> from slimit import minify
>>> text = """
... var a = function( obj ) {
... for ( var name in obj ) {
... return false;
... }
... return true;
... };
... """
>>> print minify(text)
var a=function(obj){for(var name in obj){return false;}return true;};

Iterate over, modify a JavaScript AST and pretty print it
---------------------------------------------------------
Expand Down Expand Up @@ -81,4 +118,5 @@ Using ``easy_install``::

Roadmap
-------
- Add JavaScript minification
- More minifications

2 changes: 1 addition & 1 deletion docs-source/_templates/sidebarintro.html
@@ -1,6 +1,6 @@
<h3>About SlimIt</h3>
<p>
SlimIt is a Python library that parses JavaScript and returns AST
SlimIt is a JavaScript minifier
</p>
<h3>Useful Links</h3>
<ul>
Expand Down
49 changes: 45 additions & 4 deletions docs-source/index.rst
Expand Up @@ -6,11 +6,52 @@
Welcome to SlimIt
==================================

`SlimIt` is a Python library that parses JavaScript and returns AST.
`SlimIt` is a JavaScript minifier written in Python.
It compiles JavaScript into more compact code so that it downloads
and runs faster.

At version `0.2` it includes a JavaScript parser, lexer, pretty
printer and a tree visitor.
`SlimIt` also provides a library that includes a JavaScript parser,
lexer, pretty printer and a tree visitor.

Let's minify some code
----------------------

From the command line:

.. code-block:: bash
$ slimit -h
Usage: slimit [input file]
If no input file is provided STDIN is used by default.
Minified JavaScript code is printed to STDOUT.
$ cat test.js
var a = function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
};
$
$ slimit < test.js
var a=function(obj){for(var name in obj){return false;}return true;};
Or using library API:
.. code-block:: python
>>> from slimit import minify
>>> text = """
... var a = function( obj ) {
... for ( var name in obj ) {
... return false;
... }
... return true;
... };
... """
>>> print minify(text)
var a=function(obj){for(var name in obj){return false;}return true;};
Iterate over, modify a JavaScript AST and pretty print it
---------------------------------------------------------
Expand Down Expand Up @@ -87,7 +128,7 @@ Using ``easy_install``::
Roadmap
-------
- Add JavaScript minification
- More minifications
.. toctree::
:maxdepth: 2

0 comments on commit 7126c61

Please sign in to comment.