[英]Drupal Custom Theme Missing CSS
我正在一個Drupal站點在我的本地主機上工作。 當前,它似乎輸出一些內容(數據庫正在工作),但是沒有設置樣式。
當我查看源代碼時,會看到以下內容:
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="screen" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="print" />
<link type="text/css" rel="stylesheet" href="http://localhost:88/sites/MAA/" media="all" />
<script type="text/javascript" src="http://localhost:88/sites/MAA/sites/all/modules/jquery_update/replace/jquery/1.8/jquery.min.js?v=1.8.3"></script>
也就是說,除了站點的路徑部分之外,不包括模板的CSS。 現在,.info文件如下:
; Stylesheets. Anything within the "framework" folder will be placed before all others.
stylesheets[all][] = styles/framework/reset.css
stylesheets[all][] = styles/framework/text.css
stylesheets[all][] = styles/framework/960.css
stylesheets[all][] = styles/framework/debug.css
stylesheets[all][] = styles/css/css_hides.css
; Theme specific styles. Any sub-themes should override this.
stylesheets[all][] = styles/skin.css
stylesheets[all][] = styles/maa.css
stylesheets[all][] = styles/maa-legacy.css
stylesheets[all][] = styles/jq-ui-date-range-picker/ui.daterangepicker.css
stylesheets[all][] = styles/styles_nvl.css
stylesheets[all][] = styles/css_hides.css
stylesheets[print][] = styles/print.css
; Theme specific scripts.
scripts[] = "js/enlargeit.js"
scripts[] = "js/jquery-ui.js"
scripts[] = "js/custom.js"
regions[page_top] = Page top
regions[header] = Header
regions[search_box] = Search Box
regions[main_nav] = Main Navigation
regions[highlighted] = Highlight
regions[featured] = Featured
regions[help] = Help
regions[home_content] = Home Content
regions[home_content_bottom] = Home Content Bottom
regions[content] = Content
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar
regions[footer_top] = Footer Top
regions[footer_top_left] = Footer Top Left
regions[footer_top_center_one] = Footer Top Center 1
regions[footer_top_center_two] = Footer Top Center 2
regions[footer_top_right] = Footer Top Right
regions[footer_left] = Footer Left
regions[footer_right] = Footer Right
regions[page_bottom] = Page bottom
誰能告訴我應該在哪里進行故障排除? 在html.tpl.php文件中,有一行輸出樣式,但是我找不到它的填充位置。
<?php print $styles; ?>
<?php print $scripts; ?>
解決任何Drupal問題的第一步:您是否嘗試清除緩存? (這與Drupal等效,即“您是否嘗試過將其關閉然后重新打開?”)
如何清除緩存:如果您以管理員身份登錄站點,請轉到“配置”>“開發”>“性能”。 您應該看到一個“清除所有緩存”按鈕。
如果這不起作用:您是否簽出了Drupal文檔? https://www.drupal.org/node/171209
如果聚合和壓縮CSS文件(“配置”>“開發”>“性能”中的設置)會發生什么?
將站點從生產環境復制到本地計算機時,我剛遇到此問題。 生產和暫存環境很好,因此我開始對機器進行故障排除。
遇到此特定問題時,先前的答案絕對是一個不錯的起點。 但是,真正的罪魁禍首似乎是Drupal在注冊樣式表時如何使用文件系統。
一般來說,您的html.tpl.php
文件將具有$styles
變量。 這是一個輸出的字符串,包含您在主題的.info
文件中注冊的所有樣式表。 您可能有也可能沒有預處理鈎子來更改template.php
文件中的css文件。
追溯所有這些信息並確認它是正確的之后,運行系統狀態報告將幫助您確定需要解決的區域。 在這種特定情況下,它是使用ctools
模塊的Drupal 7站點。 登錄后瀏覽到/admin/reports/status
顯示ctools無法在/sites/default/files/ctools/
創建正確的目錄。
結果是如果無法創建此目錄,Drupal將從我的樣式表中刪除URI。 驅動每個樣式表輸出的數據來自您的.info
和任何添加CSS的預處理函數。
希望這對遇到此問題並撓頭的其他人有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.