xonecas.io
142
St

startsInvasion / files

startsInvasion / libs / node_modules / reqwest / build / smoosh / README.md

4.7 KB
1SMOOOOSH.
2=========
3How would you smoosh a lion and a tiger? A tialiganer, right?
4
5![smoosh](http://f.cl.ly/items/3o0y3m3o2Z3l1e0i1V2V/Screen%20shot%202011-03-05%20at%2012.13.54%20AM.png)
6
7SMOOSH is a tool for packaging your CSS & JavaScript projects. It will lint your JavaScript with [JSHint](http://jshint.com), then build and minify your files (if you'd like) with [UglifyJS](https://github.com/mishoo/UglifyJS)
8
9Smoosh is available as an npm package. To install, run the following command:
10
11    $ npm install smoosh
12
13CONFIG
14======
15Currently, smoosh requires a config.json file to work. Your config file should look something like this (check the examples folder for a working example):
16
17    {
18      "VERSION": "0.1", // optional
19      "JSHINT_OPTS": { ... }
20      "JAVASCRIPT": {
21        "DIST_DIR": "dist", // optional
22        "base": [ ... ],
23        "secondary": [ ... ]
24      },
25      "CSS": {
26        "core": [ ... ]
27      }
28    }
29
30Your config options include:
31
32  * VERSION: an optional version number which will be appended to your built files
33  * JAVASCRIPT|CSS:
34  * key: the name of your compiled file (ie: 'mootools-core', 'base-bundle', etc.)
35  * value: an array of file paths to be bundled (ie. <code>['./src/drag.js', './src/drop.js']</code>)
36  + DIST_DIR: the directory to output your files to (if no directory is specified, 'dist' will be used)
37  + JSHINT_OPTS: the options to use if running jshint
38
39USING SMOOSH WITH TERMINAL
40==========================
41
42once installed with npm, smoosh can be accessed easily from the command line! Just create your config file (shown above), then run commands. Here's a list of some of them:
43
44
45    //any of these commands will execute all smoosh tasks with config.json
46    smoosh ./config.json
47    smoosh make ./config.json
48    smoosh -m ./config.json
49
50    //executing either of these commands will destroy the dist folder
51    smoosh clean ./config.json
52    smoosh -d ./config.json
53
54    //these will generate ugliyjs minified versions of your packaged source
55    smoosh compressed ./config.json
56    smoosh -c ./config.json
57
58    //these will generate full, uncompressed version of your packaged source
59    smoosh uncompressed
60    smoosh -f ./config.json
61
62    //executing either of these commands will build both compressed and uncompressed versions of your source
63    smoosh build ./config.json
64    smoosh -b ./config.json
65
66    //these will run jshint against your uncompressed source
67    smoosh run ./config.json
68    smoosh -r ./config.json
69
70    //the -a flag will run analyze.. you must include a build type for analyze to work
71    smoosh -ca ./config
72    smoosh -ba ./config
73    smoosh -fa ./config
74
75    //as you might have guessed, you can specify multiple flags at the same time
76    smoosh -dba ./config //<-- this will clean the dist folder, build new files, and then analyze them
77
78
79USING SMOOSH WITH THE CODEZ
80===========================
81
82once installed, smoosh is pretty easy to use...
83
84    var smoosh = require('smoosh');
85
86Once required there are several methods available to you:
87
88<code>config</code>
89------
90As stated above, smoosh requires that you pass it the path to your configuration json file. To do that, you would do:
91
92    smoosh.config('./config.json')
93
94<code>clean</code>
95-----
96The clean method will remove your distribution directory. **Warning** This will empty your entire DIST directory. So this may be unwanted behavior if your DIST directory is "./". It is preferred that this is only used when you have a dedicated dist folder. Eg: "./src/build" or "./dist"
97
98    smoosh.clean();
99
100<code>run</code>
101---
102Run takes one argument; a string which specifies what to run. Currently run only works with jslint, therefore you can do either:
103
104    smoosh.run('jslint');
105
106    //or
107
108    smoosh.run();
109
110In the future we may add more useful things here.
111
112<code>build</code>
113-----
114Build is used to build your sources together. You can build uncompressed or compressed files or both! You can use it like this:
115
116    smoosh.build('uncompressed');
117
118    //or
119
120    smoosh.build('compressed');
121
122    //or
123
124    smoosh.build() // <-- this will build both compressed and uncompressed
125
126
127<code>analyze</code>
128-------
129Analyze is useful when you're curious if you're making your files larger or smaller. It will return relevant file size for uncompressed, compressed, or gzipped files.
130
131    smoosh.analyze('uncompressed');
132
133    //or
134
135    smoosh.analyze('compressed');
136
137    //or
138
139    smoosh.analyze('gzipped'); //it gzips the compressed files only
140
141    //or
142
143    smoosh.analyze(); //which will do analyze all types
144
145<code>make</code>
146----
147Make can currently be used as a shortcut to run all smoosh methods... It requires one argument, the path to the config file.json.
148
149    smoosh.make('./config.json');
150
151    //is the same as
152    smoosh.config('./config.json').run().build().analyze();