Skip to content
Newer
Older
100644 200 lines (136 sloc) 6.43 KB
304aa37 @tj Initial commit
authored
1
f1f5b7b @tj Release 0.0.1
authored
2 # Asset
304aa37 @tj Initial commit
authored
3
5e2d8c0 @tj docs
authored
4 Asset manager for lazy people (think homebrew for assets).
d5dc3c2 @tj docs
authored
5
6 ## Installation
7
188f41a @tj fixed install docs
authored
8 $ npm install -g asset
d5dc3c2 @tj docs
authored
9
10 ## Usage
11
fc6ed4d @tj usage docs
authored
12 Usage: asset [command] [options]
d5dc3c2 @tj docs
authored
13
fc6ed4d @tj usage docs
authored
14 Commands:
d5dc3c2 @tj docs
authored
15
fc6ed4d @tj usage docs
authored
16 install <name ...> installs the given asset <name ...>
17 search [query] search available assets with optional [query]
18 info <name ...> display verbose information for the given asset <name ...>
e92b114 @tj Added `asset` command to install from ./assets.json. Closes #18
authored
19 none install dependencies from ./assets.json
fc6ed4d @tj usage docs
authored
20
21 Options:
22
23 -c, --compress compress assets
24 -o, --out <dir> output directory defaulting to ./public
25 -V, --version output program version
26 -h, --help display help information
d5dc3c2 @tj docs
authored
27
28
29
30 ## Examples
31
32 ### Installing Several Assets
33
34 By default asset installs to `./public`.
35
4bb6145 @tj docs
authored
36 $ asset raphael jquery
d5dc3c2 @tj docs
authored
37
38 install : raphael@1.4.7
4bb6145 @tj docs
authored
39 install : jquery@1.5.2
40 download : jquery@1.5.2
41 complete : jquery@1.5.2 public/jquery.js
d5dc3c2 @tj docs
authored
42 download : raphael@1.4.7
43 complete : raphael@1.4.7 public/raphael.js
b215fba @tj Added :compress modifier
authored
44
45 Asset names accept an optional version and modifiers, taking the form:
46
47 <name> ['@' version] [':' 'compress']
48
49 To install all assets (that support compression) as compressed, we can use
50 the `--compress` flag:
51
52 $ asset jquery raphael --compress
53
54 However this can be done at the asset-level as well using the `:compress` modifier:
55
56 $ asset jquery@1.4.3:compress raphael
57
58 install : jquery@1.4.3
59 install : raphael@1.4.7
60 download : jquery@1.4.3
61 complete : jquery@1.4.3 public/jquery.min.js
62 download : raphael@1.4.7
63 complete : raphael@1.4.7 public/raphael.js
d5dc3c2 @tj docs
authored
64
65 ### Install Destination
66
67 Tweak the output directory with `-o, --out <dir>`.
68
69 $ asset raphael g.raphael g.pie -o public/javascripts
70
71 install : raphael@1.4.7
72 install : g.raphael@0.4.1
73 install : g.pie@0.4.1
74 download : raphael@1.4.7
75 complete : raphael@1.4.7 public/javascripts/raphael.js
76 download : g.raphael@0.4.1
77 complete : g.raphael@0.4.1 public/javascripts/g.raphael.js
78 download : g.pie@0.4.1
79 complete : g.pie@0.4.1 public/javascripts/g.pie.js
80
59381c4 @tj Added; assume arg with "/" is --out <dir>. closes #10
authored
81 Alternatively passing a directory name containing "/" will work as well, since `asset` knows this is not an asset, and becomes equivalent to `--out <dir>`:
82
83 $ asset raphael jquery public/javascripts
84
7e922c4 @tj Added basic dependency mapping support. Closes #3
authored
85 ### Dependency Resolution
86
87 Asset currently supports extremely basic dependency mapping, for example below is the output of installing `g.pie`, which depends on `g.raphael`, which in turn depends on `raphael` itself.
88
89 $ asset g.pie
90
91 install : g.pie@0.4.1
92 dependency : g.raphael@0.4.1
93 install : g.raphael@0.4.1
94 dependency : raphael@1.4.7
95 install : raphael@1.4.7
96 download : raphael@1.4.7
97 complete : raphael@1.4.7 public/raphael.js
98 download : g.raphael@0.4.1
99 complete : g.raphael@0.4.1 public/g.raphael.js
100 download : g.pie@0.4.1
101 complete : g.pie@0.4.1 public/g.pie.js
102
1005093 @tj Added `info <name ...>` command
authored
103 ### Asset Information
104
105 Inspect verbose asset information:
106
107 $ asset info jquery g.raphael
108
109 name : jquery
110 description : jquery core framework
111 url : http://code.jquery.com/jquery-{version}.min.js
112 version : 1.5.2
113 filename : jquery.js
114
115 name : g.raphael
116 description : charting for raphael
117 url : https://github.com/DmitryBaranovskiy/g.raphael/raw/v{version}/g.raphael-min.js
118 version : 0.4.1
119 filename : g.raphael.js
120 dependencies : raphael
121
7e922c4 @tj Added basic dependency mapping support. Closes #3
authored
122
9d2a97b @tj docs
authored
123 ### Installation Destination
124
125 To install a specific version, we can use the `@` character:
126
127 $ asset jquery@1.5.0
128
d5dc3c2 @tj docs
authored
129 ### Search Repository
130
131 We can search the repository with an optional query, listing
132 available assets and their default versions:
133
134 $ asset raphael
135
136 install : raphael@1.4.7
137 download : raphael@1.4.7
138 complete : raphael@1.4.7 public/raphael.js
1edab99 @tj config docs
authored
139
e92b114 @tj Added `asset` command to install from ./assets.json. Closes #18
authored
140 ### assets.json
141
142 By adding `./assets.json` you can store application dependencies, and install them quickly and easily with a single command `asset`. For example this file may contain one or more deps:
143
144 {
145 "g.raphael": "0.4.1"
146 , "jquery": "1.5.2"
147 , "modernizr": "1.7"
148 }
149
150
151 Installed with the command:
152
153 $ asset
154
155 install : g.raphael@0.4.1
156 dependency : raphael@1.4.7
157 install : raphael@1.4.7
158 install : jquery@1.5.2
159 install : modernizr@1.7
160 download : jquery@1.5.2
161 complete : jquery@1.5.2 public/jquery.js
162 download : raphael@1.4.7
163 complete : raphael@1.4.7 public/raphael.js
164 download : g.raphael@0.4.1
165 complete : g.raphael@0.4.1 public/g.raphael.js
166 download : modernizr@1.7
167 complete : modernizr@1.7 public/modernizr.js
168
1edab99 @tj config docs
authored
169 ### Configuration
170
5941a35 @tj doc typo
authored
171 By default options must be passed via the CLI, however `asset` will also check the `./.asset` and `~/.asset` JSON configuration files, so for example a project may set `{ "out": "public/javascripts" }` if we are mainly working with javascript, however the CLI options will always take precedence.
304aa37 @tj Initial commit
authored
172
63772d1 @tj docs
authored
173 ### The Repository
174
5e2d8c0 @tj docs
authored
175 By default the repo bundled with `asset` is used, however the `~/.assets` configuration file is checked first. Perhaps down the road if/when asset becomes more flexible a repo will be hosted, for now simply fork the project edit `./assets.json`, and send a pull request.
63772d1 @tj docs
authored
176
304aa37 @tj Initial commit
authored
177 ## License
178
179 (The MIT License)
180
181 Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
182
183 Permission is hereby granted, free of charge, to any person obtaining
184 a copy of this software and associated documentation files (the
185 'Software'), to deal in the Software without restriction, including
186 without limitation the rights to use, copy, modify, merge, publish,
187 distribute, sublicense, and/or sell copies of the Software, and to
188 permit persons to whom the Software is furnished to do so, subject to
189 the following conditions:
190
191 The above copyright notice and this permission notice shall be
192 included in all copies or substantial portions of the Software.
193
194 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
195 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
196 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
197 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
198 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
199 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
200 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.