public function assets(Response $response, $asset)
    {
        $filesystem = new Filesystem(new Adapter(FS2ADMIN));
        $expires = 8640000;

        try {
            // generate cache data
            $timestamp_string = gmdate('D, d M Y H:i:s ', $filesystem->getTimestamp($asset)) . 'GMT';
            $etag = md5($filesystem->read($asset));
            $mime_type = $filesystem->getMimetype($asset);
            if (0 !== strpos($mime_type, 'image')) {
                $mime_type = 'text/css';
            }

            $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
            $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] : false;

            if ((($if_none_match && $if_none_match == "\"{$etag}\"") || (!$if_none_match)) &&
                ($if_modified_since && $if_modified_since == $timestamp_string)
            ) {
                return $response->withStatus('304');

            } else {
                $response = $response
                    ->withHeader('Last-Modified', $timestamp_string)
                    ->withHeader('ETag', "\"{$etag}\"");
            }

            // send out content type, expire time and the file
            $response->getBody()->write($filesystem->read($asset));
            return $response
                ->withHeader('Expires', gmdate('D, d M Y H:i:s ', time() + $expires) . 'GMT')
                ->withHeader('Content-Type', $mime_type)
                ->withHeader('Pragma', 'cache')
                ->withHeader('Cache-Control', 'cache');

        } catch (FileNotFoundException $e) {
            throw $e;
        }
    }