0.10.3 • Published 10 years ago

raja-minify v0.10.3

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

raja-minify

Super simple minification and concatenation for html pages proxied by raja.

After initialization of raja in your express app,

require('raja-minify')(raja);

will automatically minify scripts and stylesheets:

<script src="dir/file1.js"></script>

is replaced by

<script src="dir/file1.min.js"></script>

The "to" attribute allows one to rename a file, relative to current path:

<script to="fileA.js" src="dir/file1.js"></script>
<script to="../dir2/file2.js" src="dir/file2.js"></script>
<script to="/dir3/file3.js" src="dir/file3.js"></script>

is replaced by

<script src="dir/fileA.min.js"></script>
<script src="dir2/file2.min.js"></script>
<script src="/dir3/file3.min.js"></script>

Concatenation is done by setting successive "to" attributes. Appending ends with the first non-empty "to" attribute, or the first node without a "to" attribute.

<script src="dir/file1.js" to></script>
<script src="dir/file2.js" to></script>
<script src="dir/file3.js"></script>

and result in

<script src="dir/file2.min.js"></script>
<script src="dir/file3.min.js"></script>

or with renaming:

<script src="dir/file1.js" to></script>
<script src="dir/file2.js" to="../root.js"></script>
<script src="dir/file3.js" to></script>
<script src="dir/file4.js" to="lib2.js"></script>

and result in

<script src="root.min.js"></script>
<script src="dir/lib2.min.js"></script>

and likewise for CSS, with automatic url rebasing, autoprefixer filters, so that

<link rel="stylesheet" href="subdir/style1.css" to />
<link rel="stylesheet" href="style2.css" to="common.css" />

has its url paths in style1.css fixed (thanks to postcss-url) so that

<link rel="stylesheet" href="common.css" />

is all right.

Planned feature(s)

  • Ability to pass options to uglify-js, autoprefixer-core, csswring.
  • Automatic source maps - you don't even know you generated them.
0.10.3

10 years ago

0.10.2

10 years ago

0.10.1

10 years ago

0.10.0

10 years ago

0.9.11

10 years ago

0.9.10

10 years ago

0.9.9

10 years ago

0.9.8

10 years ago

0.9.7

10 years ago

0.9.6

10 years ago

0.9.5

10 years ago

0.9.4

10 years ago

0.9.3

10 years ago

0.9.2

10 years ago

0.9.1

10 years ago

0.9.0

10 years ago

0.8.0

10 years ago

0.7.0

10 years ago

0.6.3

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago