定制 palcera/palcera_theme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

palcera/palcera_theme

Composer 安装命令:

composer require palcera/palcera_theme

包简介

Base theme for Palcera CMS templates. Generated from Mercury, provides breakpoints, image styles, and core SDC components.

README 文档

README

A component-based Drupal theme for Palcera CMS, built on Drupal Canvas with Tailwind CSS.

Getting started

Palcera Theme is installed automatically when you use the Palcera Base site template. It can also be installed via Composer:

composer require palcera/palcera_theme

Don't sub-theme Palcera Theme

Palcera Theme does not provide backward compatibility guarantees between releases. If you need to customize beyond fonts and colors, use Drupal's starter kit tool to create your own copy:

cd drupal/web
php core/scripts/drupal generate-theme my_theme --name="My Custom Theme" --starterkit=palcera_theme

This creates an independent copy at themes/my_theme that you fully control. You can then remove the original:

composer remove palcera/palcera_theme

Customizing

There are three levels of customization, from simplest to most flexible:

1. Fonts & colors (no build required)

Edit theme.css in your theme directory. This file controls CSS custom properties (design tokens) for colors, fonts, spacing, and border radius. Changes take effect after clearing Drupal's cache — no CSS rebuild needed.

Key sections in theme.css:

Section What it controls
@theme Tailwind design tokens (colors, fonts, radius)
:root CSS custom properties for light mode
.dark CSS custom properties for dark mode
@font-face Font files and weights

2. Components & templates (build required)

Palcera Theme uses single-directory components. Each component lives in its own folder under components/ with a Twig template, YAML definition, and optional JS.

You can modify existing components or add new ones. Since the theme uses Tailwind, any changes to Twig templates or CSS files require a rebuild (see Building CSS below).

3. Full theme conversion (starter kit)

For deep customization, generate a starter kit copy (see "Don't sub-theme" above). This gives you full ownership of all templates, components, and build configuration.

Building CSS

The theme uses Tailwind CSS for utility-first styling. Install dependencies and build:

npm install
npm run build

For development with auto-rebuild on file changes:

npm run dev

Code Formatting

The theme uses Prettier with plugins for Tailwind CSS and Twig templates.

npm run format          # Format all files
npm run format:check    # Check without changing

For the best experience, set up Prettier in your editor to format on save.

Note: Some files are excluded via .prettierignore, such as html.html.twig which contains Drupal placeholder tokens that break Prettier's parser.

Component JavaScript

lib/component.js provides ComponentType and ComponentInstance classes that encapsulate Drupal behavior boilerplate:

import { ComponentType, ComponentInstance } from "../../lib/component.js";

class Accordion extends ComponentInstance {
  init() {
    this.el.querySelector(".accordion--content").classList.toggle("visible");
    this.el.addClass("js");
  }
}

new ComponentType(Accordion, "accordion", ".accordion");

Each matching element gets its own ComponentInstance with this.el pointing to it. The ComponentType handles Drupal.behaviors, once(), and element discovery.

Component instances are accessible at window.palcera_themeComponents.<name>.

Known issues

Canvas code components + Tailwind

Canvas code components are not compatible with Tailwind-based themes (including Palcera Theme). Creating a code component will break the theme styling. Workaround:

  1. Open Canvas's in-browser code editor, Global CSS tab.
  2. Paste theme.css contents at the top.
  3. Paste main.css contents below it (remove @import statements first).
  4. Save.

This is tracked in the Canvas issue queue and applies to all Tailwind-based Canvas themes.

Getting help

palcera/palcera_theme 适用场景与选型建议

palcera/palcera_theme 是一款 基于 Twig 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 palcera/palcera_theme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 palcera/palcera_theme 我们能提供哪些服务?
定制开发 / 二次开发

基于 palcera/palcera_theme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 25
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Twig

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-02-07