Permalink
Browse files

Update README.md

Resolves #120
  • Loading branch information...
ixti committed Jan 7, 2014
1 parent 7332db1 commit 133ee1e97de1d66293eb0162abfa0ea696854779
Showing with 4 additions and 38 deletions.
  1. +4 −38 README.md
View
@@ -158,51 +158,17 @@ You can use the `findAsset` method to retrieve an asset from a Mincers
environment. Pass it a logical path and you'll get a `BundledAsset`
instance back.
-If it's first time you have requested asset you'll need to `compile` it.
Call `toString` on the resulting asset to access its contents, `length` to
get its length in bytes, `mtime` to query its last-modified time, and
`pathname` to get its full path on the filesystem.
-``` javascript
-environment.findAsset('application.js').compile(function (err, asset) {
- asset.toString(); // resulting contents
- asset.length; // length in bytes
- asset.mtime; // last modified time
- asset.pathname; // full path on the filesystem
-});
-```
-
-
-#### NOTICE
-
-In comparison to Sprockets, where assets is being compiled (rendered) the same
-time (in a synchronous fashion) it is initiated. In comparison we have
-compilation "delayed", that leads into the situation that real file digest is
-available for us ONLY after file was really compiled. Here's simple example
-of `asset_path` helper:
-
-``` javascript
-function asset_path(pathname) {
- var asset = environment.findAsset(pathname);
- return asset ? asset.digestPath : '';
-}
-```
-
-The helper above works perfectly with static assets (those who have no
-processors assigned, e.g. images, fonts, etc.), but it will return you wrong
-digest path for `application.js` unless you compile it first:
-
``` javascript
var asset = environment.findAsset('application.js');
-asset.digestPath; // uses initial digest (calculated against original source)
-
-asset.compile(function (err, asset) {
- asset.digestPath; // correct digest path
-
- asset = environment.findAsset('application.js');
- asset.digestPath; // correct digest again, unless application.js was changed
-});
+asset.toString(); // resulting contents
+asset.length; // length in bytes
+asset.mtime; // last modified time
+asset.pathname; // full path on the filesystem
```

0 comments on commit 133ee1e

Please sign in to comment.