lib/charlotte.js
function(foundInCacheSeed, fullPath, data, compiled, next) {
            if (foundInCacheSeed) {
              debugLog("Found resource in cache seed: " + cacheUrl)
              if (data) {
                async.waterfall([
                  function(next) {
                    if (url.match(/\.css$/)) {
                      processStylesheet(rootUrl, version, url, data, timeout,
                        onCacheMiss, next);
                    } else {
                      next(null, data);
                    }
                  },
                ], function(err, data) {
                  if (err) return next(err);
                  writeToFile(filePath, data, function(err, fullPath) {
                    next(err, fullPath, data, compiled, null);
                  });
                });
              } else {
                next(null, fullPath, data, compiled, null);
              }
            } else {
              getServerResource(next);
            }
          }
function(foundInCacheSeed, fullPath, data, compiled, next) {
            if (foundInCacheSeed) {
              debugLog("Found resource in cache seed: " + cacheUrl)
              if (data) {
                async.waterfall([
                  function(next) {
                    if (url.match(/\.css$/)) {
                      processStylesheet(rootUrl, version, url, data, timeout,
                        onCacheMiss, next);
                    } else {
                      next(null, data);
                    }
                  },
                ], function(err, data) {
                  if (err) return next(err);
                  writeToFile(filePath, data, function(err, fullPath) {
                    next(err, fullPath, data, compiled, null);
                  });
                });
              } else {
                next(null, fullPath, data, compiled, null);
              }
            } else {
              getServerResource(next);
            }
          }
function ( foundInCacheSeed , fullPath , data , compiled , next ) { if ( foundInCacheSeed ) { debugLog ( "Found resource in cache seed: " + cacheUrl ) if ( data ) { async . waterfall ( [ function ( next ) { if ( url . match ( / \.css$ / ) ) { processStylesheet ( rootUrl , version , url , data , timeout , onCacheMiss , next ) ; } else { next ( null , data ) ; } } , ] , function ( err , data ) { if ( err ) return next ( err ) ; writeToFile ( filePath , data , function ( err , fullPath ) { next ( err , fullPath , data , compiled , null ) ; } ) ; } ) ; } else { next ( null , fullPath , data , compiled , null ) ; } } else { getServerResource ( next ) ; } }
get from server or write to cache if necessary
get from server or write to cache if necessary