SlimIt 0.8.1

JavaScript minifier

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!

What's new in SlimIt 0.8.1:

  • Bug fix: https://github.com/rspivak/slimit/pull/45 Fix syntax error in the output of for statement with some form of expressions
Read full changelog
send us
an update
LICENSE TYPE:
MIT/X Consortium License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Ruslan Spivak
HOMEPAGE:
slimit.org
CATEGORY:
ROOT \ Programming \ Compilers
SlimIt is a JavaScript minifier written in Python. The project compiles JavaScript into more compact code so that it downloads and runs faster.

Using lexer in your project

>>> from slimit.lexer import Lexer
>>> lexer = Lexer()
>>> lexer.input('a = 1;')
>>> for token in lexer:
... print token
...
LexToken(ID,'a',1,0)
LexToken(EQ,'=',1,2)
LexToken(NUMBER,'1',1,4)
LexToken(SEMI,';',1,5)


You can get one token at a time using token method:

>>> lexer.input('a = 1;')
>>> while True:
... token = lexer.token()
... if not token:
... break
... print token
...
LexToken(ID,'a',1,0)
LexToken(EQ,'=',1,2)
LexToken(NUMBER,'1',1,4)
LexToken(SEMI,';',1,5)


LexToken instance has different attributes:

>>> lexer.input('a = 1;')
>>> token = lexer.token()
>>> token.type, token.value, token.lineno, token.lexpos
('ID', 'a', 1, 0)


Installation:

Using pip:

sudo pip install slimit

Using easy_install:

sudo easy_install slimit

Last updated on June 7th, 2012

requirements

#JavaScript minifier #JavaScript lexer #JavaScript compiler #JavaScript #minifier #lexer #compiler

Add your review!

SUBMIT