Lime\Helper\Assets::script PHP Method

script() public method

Compile scripts and return in a script tag
public script ( Array $assets, String $name, String $path = "", Float $cache, boolean $version = false ) : String
$assets Array
$name String
$path String
$cache Float
$version boolean
return String
    public function script($assets, $name, $path = "", $cache = 0, $version = false)
    {
        $path = $this->path($path);
        if (!$path) {
            return null;
        }
        $src = rtrim($this->pathToUrl($path), '/') . "/{$name}.js" . ($version ? "?ver={$version}" : "");
        $path .= "/{$name}.js";
        $tag = '<script src="' . $src . '" type="text/javascript"></script>' . "\n";
        if ($cache && file_exists($path) && time() - filemtime($path) < $cache) {
            return $tag;
        }
        $result = $this->compile($assets, "js");
        if ($result) {
            file_put_contents($path, $result);
            return $tag;
        }
        return null;
    }