简体   繁体   English

Drupal 7 新手:尝试了解 CSS

[英]New to Drupal 7: Trying to figure out CSS

I inherited an already built Drupal 7 site.我继承了一个已经建立的 Drupal 7 站点。 I have been able to figure out many things.我已经能够弄清楚很多事情。 But I am unclear on the CSS.但我不清楚CSS。 A found a folder full of long-named CSS files but the code is all minified and hard to read. A 发现一个文件夹中充满了长命名的 CSS 文件,但代码全部缩小且难以阅读。 The previous developer had to be using some tools or services to alter and change the code in a more readable way.以前的开发人员必须使用一些工具或服务以更易读的方式更改和更改代码。 Does any know what the deal is ?有谁知道是什么交易?

Also, I cant seem to find any way inside Drupal to enter CSS.此外,我似乎无法在 Drupal 中找到任何方式来输入 CSS。 I do not even see any classes or ID assigned to the blocks, views, nodes, or fields.我什至没有看到分配给块、视图、节点或字段的任何类或 ID。 So I have no clue how they were able to customize this site at all even though they obviously did.所以我完全不知道他们是如何定制这个网站的,即使他们显然做到了。 It uses Bootstrap 3 as a theme.它使用 Bootstrap 3 作为主题。 Can anyone help explain how this works?任何人都可以帮助解释这是如何工作的吗?

I will try to figure out the essence of the informations you given.我会试着弄清楚你提供的信息的本质。

First: You have a Drupal 7 installation with compressed css files based on Bootstrap.首先:您有一个基于 Bootstrap 的带有压缩 css 文件的 Drupal 7 安装。 That sounds the theme use less or sass precompiler for the theme css and you have the production (builded) instance of the project.这听起来主题对主题 css 使用 less 或 sass 预编译器,并且您拥有项目的生产(构建)实例。 Without the uncompressed less/sass/scss files it will be hard to edit the css.如果没有未压缩的 less/sass/scss 文件,将很难编辑 css。 if you have no way to get the source files, the best way you can try is to add a extra css file and write you own css in it.如果您无法获取源文件,您可以尝试的最佳方法是添加一个额外的 css 文件并在其中编写您自己的 css。

Second: Drupal strictly separates the code from the administration interface.第二:Drupal 将代码与管理界面严格分开。 Your PHP, HTML, CSS and other codes (except the WYSIWYG output) should not be entered via the administration interface.您的 PHP、HTML、CSS 和其他代码(WYSIWYG 输出除外)不应通过管理界面输入。 That's the best practice way.这是最好的实践方式。 But anyway, there is a couple of modules that allows to write code inside the Drupal backend like this https://www.drupal.org/project/extra_css_js但无论如何,有几个模块允许在 Drupal 后端编写代码,如下所示https://www.drupal.org/project/extra_css_js

Third: As information for you, Drupal 7s End of life is on November 28, 2022 so the best and recommanded way for you is: Freeze the Drupal 7s Instance as is (only Sercurity Updates and Hotfixes) and relaunch the Project with Drupal 9.第三:作为给您的信息,Drupal 7s 的生命周期将于 2022 年 11 月 28 日结束,因此对您来说最好和推荐的方法是:按原样冻结 Drupal 7s 实例(仅限 Sercurity 更新和修补程序)并使用 Drupal 9 重新启动该项目。

Drupal theme css files are mostly located in theme folder like "theme folder/css/style.css". Drupal 主题 css 文件大多位于“主题文件夹/css/style.css”等主题文件夹中。 As above mentioned, it might be used css minify tool or module for theme performance aspects.如上所述,它可以用于主题性能方面的 css minify 工具或模块。 If it is created by drupal tools/module then once cache clear it will delete automatically and regenerate with new one with updated new css code on after page visit.如果它是由 drupal 工具/模块创建的,那么一旦缓存清除,它将自动删除并在页面访问后使用更新的新 css 代码重新生成新的。 You can also add custom css file by hook alter.您还可以通过钩子更改添加自定义 css 文件。

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

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