|
|
@@ -107,11 +107,24 @@ Serve static files. |
|
|
|
files in the `web` directory under `/static`, so `/static/script.js` will |
|
|
|
serve `web/script.js`. |
|
|
|
|
|
|
|
### Transformations - app.transform(extension, mime, function) |
|
|
|
### Transformations - app.transform(extension, mime, func) |
|
|
|
|
|
|
|
Webframe has a way to transform files of one file type to an other, for example |
|
|
|
transforming typescript into javascript, or sass into CSS. |
|
|
|
|
|
|
|
* `extension`: The file extension to transform. |
|
|
|
* `mime`: The result mime type. |
|
|
|
* `func`: function(path, writeStream). The transform function. |
|
|
|
* `writeStream.headersSent`: Whether headers have been sent or not. |
|
|
|
* `writeStream.status`: The status code. Default: 200 (or 500 for errors) |
|
|
|
* `writeStream.headers`: An object containing the headers to be sent. |
|
|
|
Default: `{ "content-type": <mime> }` |
|
|
|
* `writeStream.write`: function(data). Write response data. |
|
|
|
* `writeStream.end`: function([data]). End the request, optionally with |
|
|
|
response data. |
|
|
|
* `writeStream.error`: function(err). Log an error, respond with status |
|
|
|
code 500 (or the content of `writeStream.status` if it's not 200). |
|
|
|
|
|
|
|
Example (assumes you have the node-sass module installed): |
|
|
|
|
|
|
|
``` |