简体   繁体   English

typo3将自定义css添加到引导程序包

[英]typo3 add custom css to bootstrap package

I try to add custom css classes to bootstrap package included in Typo3 6.2. 我尝试将自定义css类添加到Typo3 6.2中包含的引导程序包中。 In my root template page, I add in the Setup section the following code: 在我的根模板页面中,在“设置”部分中添加以下代码:

page = PAGE
page.includeCSS.myCustomStylesheet = fileadmin/template/css/custom.css

but this typoscript has no effect in my source code, as if nothing is written. 但这打字稿对我的源代码没有任何作用,好像什么也没写。

Actually, when I include Bootstrap Package template in static template, every Basis templates are removed. 实际上,当我在静态模板中包括Bootstrap Package模板时,每个Basis模板都会被删除。

Any idea on how to proceed? 对如何进行有任何想法吗?

在此处输入图片说明

Edit: In bootstrap package, all CSS stylesheets are merged into a single file. 编辑:在bootstrap包中,所有CSS样式表都合并到一个文件中。

the »EXT:«-string in your path is a shortcut to the extension-directory (»./typo3conf/ext/«). 路径中的»EXT:«字符串是扩展目录(»./typo3conf/ext/«)的快捷方式。 So in your example you would have an extension called »path_to_my_css«. 因此,在您的示例中,您将具有一个名为»path_to_my_css«的扩展名。

But i guess you probably uploaded a stylesheet into your filelist. 但是我想您可能已经将样式表上传到了文件列表中。 If so, then click on the file to the see full path (like » http://example.com/fileadmin/templates/assets/css/bootstrap.css 如果是这样,请单击文件以查看完整路径(例如» http://example.com/fileadmin/templates/assets/css/bootstrap.css )«

Then set the correct path like this 然后像这样设置正确的路径

page.includeCSS.myCustomStylesheet = fileadmin/templates/assets/css/bootstrap.css

You will now see a link to your file with an appended hash in the HTML sourcecode 现在,您将在HTML源代码中看到带有附加哈希的文件链接。

<link rel="stylesheet" type="text/css" href="/fileadmin/templates/assets/css/bootstrap.css?1350898986" media="all">

I had the same problem and found a solution on the github site of the bootstrap package. 我遇到了同样的问题,并在bootstrap包的github站点上找到了解决方案。 The problem is the default css concatenation and compression. 问题是默认的CSS串联和压缩。 If you deactivate it by 如果您通过以下方式停用它

config.concatenateCss = 0

the css will be correctly included. CSS将被正确包含。

Source: https://github.com/benjaminkott/bootstrap_package/issues/33 资料来源: https : //github.com/benjaminkott/bootstrap_package/issues/33

There is a similar option for Javascript files: Javascript文件有一个类似的选项:

config.concatenateJs = 0

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM