drupal-canvas

GitHub

Drupal Canvas 交互式组件开发指南,涵盖脚手架创建、Nebula模板、SSR架构及Acquia集成,支持TypeScript与Scoped CSS。

skills/drupal-canvas/SKILL.md grasmash/drupal-claude-skills

Trigger Scenarios

使用 @drupal-canvas/create 进行项目初始化 配置 Nebula 启动模板 开发 Drupal Canvas 服务端渲染组件 集成 Acquia Source Site Builder

Install

npx skills add grasmash/drupal-claude-skills --skill drupal-canvas -g -y
More Options

Use without installing

npx skills use grasmash/drupal-claude-skills@drupal-canvas

指定 Agent (Claude Code)

npx skills add grasmash/drupal-claude-skills --skill drupal-canvas -a claude-code -g -y

安装 repo 全部 skill

npx skills add grasmash/drupal-claude-skills --all -g -y

预览 repo 内 skill

npx skills add grasmash/drupal-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "drupal-canvas",
    "description": "Drupal Canvas Code Components - a framework for building interactive, server-side-rendered components in Drupal. Covers scaffolding with @drupal-canvas\/create, the Nebula starter template, component architecture, and integration with Acquia Source Site Builder."
}

Drupal Canvas Code Components

Canvas Code Components enable interactive, server-side-rendered components in Drupal using modern JavaScript patterns with full Drupal integration.

When This Skill Activates

Activates when working with:

  • Canvas Code Components (creation, configuration, styling)
  • @drupal-canvas/create scaffolding tool
  • Nebula starter template
  • Acquia Source Site Builder integration
  • Component-based Drupal architecture

Quick Start

Scaffold a New Canvas Project

npx @drupal-canvas/create my-project

This creates a complete Drupal project with Canvas Code Components pre-configured, including:

  • Drupal core with Canvas module
  • Example components
  • Development tooling
  • Nebula starter template

Install Canvas Skills for Detailed Guidance

For comprehensive component development guidance (7 detailed skills covering definition, metadata, composability, styling, utilities, data fetching, and upload workflows):

npx skills add drupal-canvas/skills

What Are Code Components?

Code Components are Drupal's approach to interactive, reusable UI components that:

  • Server-side rendered — Full SSR with hydration, not client-only
  • Drupal-integrated — Access entities, fields, views, and Drupal APIs
  • Composable — Nest components, pass props, emit events
  • Styled — Scoped CSS with design token support
  • Type-safe — Full TypeScript support with prop validation

Component Structure

my-component/
├── my-component.component.tsx   # Component logic
├── my-component.metadata.json   # Drupal integration metadata
├── my-component.styles.css      # Scoped styles
└── my-component.utils.ts        # Optional utilities

Example Component

import { type ComponentProps } from '@drupal-canvas/sdk';

export default function MyComponent({ title, items }: ComponentProps) {
  return (
    <div className="my-component">
      <h2>{title}</h2>
      <ul>
        {items.map((item, i) => (
          <li key={i}>{item.label}</li>
        ))}
      </ul>
    </div>
  );
}

Ecosystem

Nebula Starter Template

The recommended starting point for new Canvas projects. Includes:

  • Pre-configured Drupal with Canvas module
  • Example components demonstrating all patterns
  • DDEV local development setup
  • Deployment configuration

Acquia Source Site Builder

Canvas components integrate with Acquia's Source Site Builder for:

  • Visual component placement and configuration
  • Content editor-friendly component management
  • Design system integration
  • Multi-site component sharing

Canvas Skills Collection

Install the full Canvas skills collection for detailed development guidance:

npx skills add drupal-canvas/skills

Covers 7 topics:

  1. Component Definition — Creating and registering components
  2. Metadata — Drupal integration via metadata.json
  3. Composability — Nesting, props, events, slots
  4. Styling — Scoped CSS, design tokens, theming
  5. Utilities — Helper functions and shared logic
  6. Data Fetching — Entity queries, views integration, API calls
  7. Upload — Deploying components to Drupal

Resources

  • Scaffolding: npx @drupal-canvas/create
  • Canvas Skills: npx skills add drupal-canvas/skills
  • Drupal Canvas Module: Available via Composer
  • Nebula Template: Included with @drupal-canvas/create

Version History

  • eb9b3d3 Current 2026-07-25 05:35

Dependencies

  • suggested drupal-canvas/skills

Same Skill Collection

skills/acquia-source/SKILL.md
skills/canvas-contribution/SKILL.md
skills/drupal-at-your-fingertips/SKILL.md
skills/drupal-canvas-sdc/SKILL.md
skills/drupal-config-mgmt/SKILL.md
skills/drupal-config-reconcile/SKILL.md
skills/drupal-contrib-mgmt/SKILL.md
skills/drupal-ddev/SKILL.md
skills/drupal-search-api/SKILL.md
skills/drupal-simple-oauth/SKILL.md
skills/drupal-testing/SKILL.md
skills/ivangrynenko-cursorrules-drupal/SKILL.md
skills/skill-developer/SKILL.md

Metadata

Files
0
Version
eb9b3d3
Hash
3be4ce58
Indexed
2026-07-25 05:35

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 04:41
浙ICP备14020137号-1 $Гость$