Drupal 主题无法读取 CSS 文件

发布于 2024-10-15 11:44:10 字数 407 浏览 1 评论 0 原文

我目前正在开发一个 drupal 主题,但在让主题读取该死的 css 文件时一直遇到问题。我开始使用 Framework 主题进行主题化,我尝试组织那里的文件,例如创建一个子目录来存储 CSS 文件,更改 .info 文件中的设置,以便它知道它位于 css 文件夹中,但它不会读取该死的文件。

快进几天,我已经完成了 60% 的主题样式和布局,因此决定将所有内容移植到新的主题文件夹而不是框架主题文件夹中。组织了文件夹和文件,但无论我将 CSS 文件放在子目录中还是与 .info 文件放在同一目录中,它都不会读取 CSS 文件。它以某种方式工作过一次,但后来就再也没有工作过。

我尝试过清除缓存等,但没有效果。

我正在本地 wamp 服务器上工作。 Drupal 是最新版本 7。

有什么想法可以解决这个问题吗?

谢谢

I'm currently working on a drupal theme but keep having problems with getting the theme to read the damn css file. I started off theming with the Framework theme, I tried organising the files on there for example creating a subdirectory to store the CSS file, change the setting in the .info file so it knows it's in the css folder, but it won't read the damn file.

Fast forward a few days and I've got 60% of my theme styled and layout-ed, so decided to port everything into a new theme folder rather than the Framework theme folder. Organised the folders and files, but again it won't read the CSS file whether I put it in a subdirectory or in the same directory as the .info file. It somehow worked once, but then went and hasn't worked again.

I've tried clearing the cache etc, but to no avail.

I'm working on a local wamp server. Drupal is latest version 7.

Any ideas how to fix this problem?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲性难收 2024-10-22 11:44:10

您使用的是哪个版本的 Drupal?在 Drupal 6 中,这工作正常:

/* mytheme.info */
stylesheets[all][]   = assets/css/master.css
stylesheets[all][]   = assets/css/typo.css

此文件位于我的主题文件夹中

Folder: MYTHEME
   File: mytheme.info
   Folder: assets
       Folder: css
           File: master.css
           File: typo.css

Wich version of Drupal you are using? In Drupal 6 this works fine:

/* mytheme.info */
stylesheets[all][]   = assets/css/master.css
stylesheets[all][]   = assets/css/typo.css

This files are in my Theme folder

Folder: MYTHEME
   File: mytheme.info
   Folder: assets
       Folder: css
           File: master.css
           File: typo.css
青衫儰鉨ミ守葔 2024-10-22 11:44:10

我知道这有点晚了,但也许对其他人有帮助。

我正在使用 Drupal 7,并尝试在 .info 文件的自定义模块中添加 javascript 和样式表文件。

模块.always.js

module.always.css

它会加载第一个,但不会加载第二个。我什至将样式表放在信息文件中的脚本上方,它仍然只会加载第一个文件。认为这是目录并尝试在文件路径周围添加引号,但这没有任何作用。还以为是额外的。在文件名中,但这也没关系。

我可以加载这两个文件的唯一方法是将它们从 .info 文件中删除,并在 module_init() 函数中为这些文件添加 drupal_add_js 和 drupal_add_css 。

不知道为什么会出现这种情况,但至少有解决办法。

I know this is a bit late but maybe it will help someone else.

I'm using Drupal 7 and I attempted to add a javascript and stylesheet file in a custom module in the .info file.

module.always.js
and
module.always.css

It would load the first but not the second. I even put the stylesheet above the script in the info file and it would still just load the first file. Thought it was the directory and tried adding quotes around the file paths but that did nothing. Also thought it was the extra . in the file name but that didn't matter either.

The only way I could get both files to load was to remove them from the .info file and add a drupal_add_js and drupal_add_css for these files in the module_init() function.

No clue why that is the case but at least there is a work around.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文