gpt4 book ai didi

php - Joomla 3 addStyleSheet,将 "rel"属性更改为 "stylesheet/less"

转载 作者:行者123 更新时间:2023-11-28 13:18:56 26 4
gpt4 key购买 nike

我正在开发模板,并且正在使用客户端 JavaScript 编译器处理 .less 文件。此编译器需要 rel="stylesheet/less" 属性来了解要编译的内容。

所以我有这段代码:

$doc->addStyleSheet( $this->baseurl.'/templates/'.$this->template.'/css/style.less', 'text/css' );

生成

<link type="text/css" href="/templates/sss/css/style.less" rel="stylesheet">

那么如何更改我的 php addStyleSheet 代码以生成此输出?

<link type="text/css" href="/templates/sss/css/style.less" rel="stylesheet/less">

最佳答案

Joomla 在使用 $doc->addStyleSheet(); 时不支持 rel="stylesheet/less"。显然有很多解决方法,但它会涉及侵入核心 Joomla 代码,我什至不想进入。

在他们添加此功能之前,目前唯一的解决方案是使用:

<link type="text/css" href="/templates/sss/css/style.less" rel="stylesheet/less">

您也可以使用 $doc->addCustomTag(); 但这几乎是一样的。

关于php - Joomla 3 addStyleSheet,将 "rel"属性更改为 "stylesheet/less",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16421150/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com