ubc-web-services/kraken
Composer 安装命令:
composer require ubc-web-services/kraken
包简介
A Drupal UBC CLF theme
README 文档
README
A responsive UBC CLF (Common Look and Feel) theme for Drupal using Tailwind and Bootstrap. Created by the UBC IT Web Services Department.
Kraken is a theme for Drupal 10+, providing UBC-branded units with the basic structure of the UBC CLF (Common Look and Feel).
Recommended use.
Include the theme in your project using composer require ubc-web-services/kraken
Then, use the theme as a starterkit to create your own:
cd web
php core/scripts/drupal generate-theme [themename] --name "[themename]" --starterkit kraken --path themes/custom
You should then alter the generated theme as needed and leave kraken untouched.
Using the theme
To make changes to the theme CSS and Javascript, you are required to use the command-line tools.
Requirements
Ensure that you have node.js installed, version 12 or higher. To confirm your version, navigate to the Kraken theme directory in your command-line and type node -v.
Installation
From the theme root, install the theme dependencies:
npm install
This will install everything required to work with the CSS and Javascript:
- the Tailwindcss utility-based CSS library
- packages such as Webpack, Babel, Postcss, and Autoprefixer that automate building and preparing the web assets.
Running the commands
There are four main node.js commands defined in in /package.json.
The two most common commands to run:
-
npm run dev- compiles the CSS in the
/src/cssdirectory, excluding the subdirectories, and saves the minified files in/css. Settings in/postcss.config.js - compiles the Javascript in the
/src/cssdirectory, excluding the subdirectories, and saves the unminified files in/js. Settings in/webpack.common.jsand/webpack.dev.js
- compiles the CSS in the
-
npm run prod- compiles the CSS in the
src > cssdirectory, excluding the subdirectories, and saves the minified files in/css. Settings in/postcss.config.js - compiles the Javascript in the
/src/cssdirectory, excluding the subdirectories, and saves the minified files in/jswith a.min.jsextension. Settings in/webpack.common.jsand/webpack.prod.js - saves an external sourcemap (
.mapfile) to facilitate debugging. Settings in/webpack.prod.js
- compiles the CSS in the
There are also additional commands for CSS property sorting:
-
npm run css-lint- checks CSS in the
/src/cssdirectory for the order in which properties are declared and best practices.
- checks CSS in the
-
npm run css-fix- attempts to automatically fix the errors that are found with the
npm run css-lintcommand.
- attempts to automatically fix the errors that are found with the
Tailwindcss
The theme makes extensive use of utility classes provided by Tailwind.
All configuration for Tailwind utilities are set in /tailwind.config.js. The configuration uses UBC default colours, fonts, regular spacing, etc. More details about this file can be found in the Tailwind documentation.
Two very important places where it diverges fro the documentation:
- Separators: by default, Tailwind uses a colon to separate media query and state prefixes, whereas the config defines the prefix separator as a double dash. For example,
md:text-white hover:text-blackbecomemd--text-white hover--text-black - Colour palette: the config excludes Tailwind's default colurs and replaces them with UBC colours and a few user-defined colours.
When running the production build script (npm run prod), PurgeCSS is used to scan all Twig and Javascript files and remove any Tailwind utilities that are not in use. This allows for us to deliver a considerably smaller set of CSS classes. Note that classes not provided by Tailwind are never purged.
Additionally, all vendor prefixes for supported browsers are added automatically with Autoprefixer, so there is no need to add these (e.g. -webkit).
I highly recommend installing the Tailwind VS Code extension. It provides code completion for Tailwind utility classes as defined in the tailwind.config.js file. Another useful utility is the Headwind VS Code extension, that sorts classes in your markup based on an opinionated order.
Kraken theme settings
Once installed and set to default, you can adjust the following theme settings:
- switch between v.7 and v.8 of the CLF (note that v.7 of the CLF is not from the CDN and contains a subset of the full CLF).
- adjust the CSS and Javascript you load between development and production versions.
- set the theme colour options and have those same colours available using the
var(--color-primary),--color-secondaryand--color-accentCSS variables. These are also mapped to Tailwind classes. - change the base font size and line heights to adjust the overall relative sizing and vertical spacing of the type.
- add a CWL login option to the login page.
- optionally load the CLF fonts from the Google Fonts service.
- add verification header tags for Google and Bing search services.
- opt into a set of svg icons that can be added to the site via the svg
usetag
Planned settings (not yet feature complete)
- enable dark mode
ubc-web-services/kraken 适用场景与选型建议
ubc-web-services/kraken 是一款 基于 Twig 开发的 Composer 扩展包,目前已累计 1.97k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ubc-web-services/kraken 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ubc-web-services/kraken 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-09-23