【问题标题】:Drupal Bootstrap Subtheme not styling the pageDrupal Bootstrap 子主题没有设置页面样式
【发布时间】:2018-02-14 03:14:21
【问题描述】:

使用 Drupal 7 和 Boostrap 3,我已经完成了创建子主题的步骤,但我仍然没有得到我认为应该的样子。当我启用并将子主题设置为默认值时,这就是我的页面的样子。我在视频中观看了其他人以及他们的步骤,当您启用它时,他们的页面看起来就像引导程序。我和我的团队对这一切都感到非常困惑。我们是 Drupal 和 Boostrap 的新手,我们已经深入研究了这个项目。 现在这是我启用 Boostrap 作为我的默认主题时的屏幕截图,以及我期望子主题的样子。 这是我文件的截图。 这是我在 .info 文件中的内容 name = '我的主题'

description = My theme I am trying to get to work.
core = 7.x
base theme = bootstrap


;;;;;;;;;;;;;;;;;;;;;
;; Regions
;;;;;;;;;;;;;;;;;;;;;

regions[navigation]     = 'Navigation'
regions[header]         = 'Top Bar'
regions[highlighted]    = 'Highlighted'
regions[help]           = 'Help'
regions[content]        = 'Content'
regions[sidebar_first]  = 'Primary'
regions[sidebar_second] = 'Secondary'
regions[footer]         = 'Footer'
regions[page_top]       = 'Page top'
regions[page_bottom]    = 'Page bottom'


;;;;;;;;;;;;;;;;;;;;;
;; Stylesheets
;;;;;;;;;;;;;;;;;;;;;

stylesheets[all][] = css/style.css


;;;;;;;;;;;;;;;;;;;;;
;; Scripts
;;;;;;;;;;;;;;;;;;;;;

scripts[] = 'bootstrap/assets/javascripts/bootstrap/affix.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/alert.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/button.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/carousel.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/collapse.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/dropdown.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/modal.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/tooltip.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/popover.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/scrollspy.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/tab.js'
scripts[] = 'bootstrap/assets/javascripts/bootstrap/transition.js'

; Disable the CDN provider so compiled source files can be used.
settings[bootstrap_cdn] = ''

我的问题是,为什么不设置页面样式?有什么我想念的吗?当我什至无法判断它是否正常工作时,我应该如何让 sass 影响页面。我把它放到 Drupal 识别子主题的地方,我可以启用它,但这就是我所能得到的。

【问题讨论】:

    标签: web drupal sass drupal-7 themes


    【解决方案1】:

    我有两个建议:

    1 - 尝试启用基本主题。因此,当您将 MyTheme 设置为默认主题时,请注意应启用引导主题。

    2 - 在您的文件的屏幕截图中,我看不到 css 目录。您是否将scss文件编译成css文件?请注意,.info 文件包含以下行:

    stylesheets[all][] = css/style.css
    

    所以你自定义模块的所有样式都必须在 MyTheme 目录的 css/style.css 文件中

    【讨论】:

    • 做到了,修复了一些问题,但现在我在页面上收到有关不正确 CSS 的错误消息。我放入了我显然丢失的文件,并且我从该站点获得的引导文件(顺便说一句未触及)有一些错误。就像我所做的唯一修改是添加一个包含 style.scss 调用的框架的文件夹,当我在 Koala 中编译它们时,这些文件返回错误。
    【解决方案2】:
    1. 下载bootstrap主题并将其添加到您的主题中 目录(站点/所有/主题)
    2. 启用您的子主题。
    3. 尝试清除缓存 (yoursite.com/admin/config/development/performance)
    4. 点击按钮:Clear all caches
    5. 取消选中带宽优化下的两个复选框

      • 聚合和压缩 CSS 文件。
      • 聚合 JavaScript 文件。

    【讨论】:

    • 这样做了大约六次。不开玩笑,我什至让另一个团队成员也这样做,他也得到了同样的结果。
    • 最近的日志消息中是否记录了任何错误?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-03
    相关资源
    最近更新 更多