src/Asset/Assetic.php
public function assetJs($url = null, $path = null, $compress = true)
    {

        // Basic paths
        $srcPath = $this->routeMap['assets']['assetsPath'] . $this->routeMap['assets']['assetsDir'] . '/' . $url;
        if (is_null($path)) {
            $path = 'assets';
            if (isset($this->routeMap['assets']['assetsDir']) and !empty($this->routeMap['assets']['assetsDir'])) {
                $path = $this->routeMap['assets']['assetsDir'];
                $this->checkDir($path);
            }
            $dstPath = $this->routeMap['assets']['cachePath'] . $path . '/' . $url;
        } else {
            $dstPath = $this->routeMap['assets']['cachePath'] . $path;
        }

        // Copying a file if it does not exist
        if (!file_exists($dstPath)) {
            if (!file_exists($srcPath)) {
                return $srcPath;
            }

            $pathInfo = pathinfo($dstPath);
            if (!file_exists($pathInfo['dirname'])) {
                if (!mkdir($pathInfo['dirname'], 0777, true)) {
                    throw new AsseticException('Unable to create' . $path, 403);
                }
            }

            $js = file_get_contents($srcPath);
            if ($compress === true and $this->routeMap['assets']['minifyJsEnabled'] == true) {
                $jSqueeze = new JSqueeze();
                $js = $jSqueeze->squeeze($js, true, true, false);
            }

            if (!file_put_contents($dstPath, $js)) {
                $msg = date('Y-m-d h:m:s') . ' :: Unable to copy an asset From: ' . $srcPath . ' TO ' . $dstPath . "\n";
                $out = fopen(APP_DIR . '/View/logs/router.txt', 'w');
                fwrite($out, $msg);
                fclose($out);
            }
        }

        // Return the link to the copy
        $expressionUrl = $url;
        $url = $this->requestPrefix . $this->routeMap['assets']['cacheUrl'] . $path . '/';
        $url .= $expressionUrl;

        return $url;
    }
public function assetJs($url = null, $path = null, $compress = true)
    {

        // Basic paths
        $srcPath = $this->routeMap['assets']['assetsPath'] . $this->routeMap['assets']['assetsDir'] . '/' . $url;
        if (is_null($path)) {
            $path = 'assets';
            if (isset($this->routeMap['assets']['assetsDir']) and !empty($this->routeMap['assets']['assetsDir'])) {
                $path = $this->routeMap['assets']['assetsDir'];
                $this->checkDir($path);
            }
            $dstPath = $this->routeMap['assets']['cachePath'] . $path . '/' . $url;
        } else {
            $dstPath = $this->routeMap['assets']['cachePath'] . $path;
        }

        // Copying a file if it does not exist
        if (!file_exists($dstPath)) {
            if (!file_exists($srcPath)) {
                return $srcPath;
            }

            $pathInfo = pathinfo($dstPath);
            if (!file_exists($pathInfo['dirname'])) {
                if (!mkdir($pathInfo['dirname'], 0777, true)) {
                    throw new AsseticException('Unable to create' . $path, 403);
                }
            }

            $js = file_get_contents($srcPath);
            if ($compress === true and $this->routeMap['assets']['minifyJsEnabled'] == true) {
                $jSqueeze = new JSqueeze();
                $js = $jSqueeze->squeeze($js, true, true, false);
            }

            if (!file_put_contents($dstPath, $js)) {
                $msg = date('Y-m-d h:m:s') . ' :: Unable to copy an asset From: ' . $srcPath . ' TO ' . $dstPath . "\n";
                $out = fopen(APP_DIR . '/View/logs/router.txt', 'w');
                fwrite($out, $msg);
                fclose($out);
            }
        }

        // Return the link to the copy
        $expressionUrl = $url;
        $url = $this->requestPrefix . $this->routeMap['assets']['cacheUrl'] . $path . '/';
        $url .= $expressionUrl;

        return $url;
    }
@param null $url
@param null $path
@param bool $compress

@return null|string
@throws AsseticException