public function computeAssetUrl($assetType, $params, \Smarty_Internal_Template $template, $allowFilters = true)
    {
        $file = $params['file'];

        // The 'file' parameter is mandatory
        if (empty($file)) {
            throw new \InvalidArgumentException(
                "The 'file' parameter is missing in an asset directive (type is '$assetType')"
            );
        }

        $assetOrigin  = isset($params['source']) ? $params['source'] : ParserInterface::TEMPLATE_ASSETS_KEY;
        $filters      = $allowFilters && isset($params['filters']) ? $params['filters'] : '';
        $debug        = isset($params['debug']) ? trim(strtolower($params['debug'])) == 'true' : false;
        $templateName = isset($params['template']) ? $params['template'] : false;
        $failsafe     = isset($params['failsafe']) ? $params['failsafe'] : false;

        Tlog::getInstance()->debug("Searching asset $file in source $assetOrigin, with template $templateName");

        /** @var \TheliaSmarty\Template\SmartyParser $smartyParser */
        $smartyParser = $template->smarty;

        if (false !==  $templateName) {
            // We have to be sure that this external template assets have been properly prepared.
            // We will assume the following:
            //   1) this template have the same type as the current template,
            //   2) this template assets have the same structure as the current template
            //     (which is in self::$assetsDirectory)
            $currentTemplate = $smartyParser->getTemplateDefinition();

            $templateDefinition = new TemplateDefinition(
                $templateName,
                $currentTemplate->getType()
            );

            /* Add this templates directory to the current list */
            $smartyParser->addTemplateDirectory(
                $templateDefinition->getType(),
                $templateDefinition->getName(),
                THELIA_TEMPLATE_DIR . $templateDefinition->getPath(),
                ParserInterface::TEMPLATE_ASSETS_KEY
            );

            $this->prepareTemplateAssets($templateDefinition, self::$assetsDirectory, $smartyParser);
        }

        $assetUrl = $this->assetsResolver->resolveAssetURL(
            $assetOrigin,
            $file,
            $assetType,
            $smartyParser,
            $filters,
            $debug,
            self::$assetsDirectory,
            $templateName
        );

        if (empty($assetUrl)) {
            // Log the problem
            if ($failsafe) {
                // The asset URL will be ''
                Tlog::getInstance()->addWarning("Failed to find asset source file " . $params['file']);
            } else {
                throw new TheliaProcessException("Failed to find asset source file " . $params['file']);
            }
        }

        return $assetUrl;
    }