简体   繁体   English

Drupal主题不会读取CSS文件

[英]Drupal theme won't read CSS file

I'm currently working on a drupal theme but keep having problems with getting the theme to read the damn css file. 我目前正在研究drupal主题,但是在获取该主题以读取该死的CSS文件方面一直遇到问题。 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. 我以Framework框架主题开始主题设置,尝试将文件整理在那里,例如创建一个子目录来存储CSS文件,更改.info文件中的设置,使其知道它在css文件夹中,但不会读取该死的文件。

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. 快进几天,我的主题风格和布局已经达到60%,因此决定将所有内容移植到新的主题文件夹中,而不是Framework主题文件夹中。 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. 组织了文件夹和文件,但是无论我将其放在子目录中还是与.info文件位于同一目录中,它都不会读取CSS文件。 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. 我正在使用本地Wamp服务器。 Drupal is latest version 7. Drupal是最新版本7。

Any ideas how to fix this problem? 任何想法如何解决此问题?

Thank you 谢谢

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. 我正在使用Drupal 7,并且尝试在.info文件的自定义模块中添加javascript和样式表文件。

module.always.js and module.always.css module.always.js和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. 我可以加载这两个文件的唯一方法是从.info文件中删除它们,并在module_init()函数中为这些文件添加drupal_add_js和drupal_add_css。

No clue why that is the case but at least there is a work around. 不知道为什么会这样,但至少可以解决。

Wich version of Drupal you are using? 您正在使用Wich版本的Drupal吗? In Drupal 6 this works fine: 在Drupal 6中可以正常工作:

/* 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

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

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