studio-stomp/craft-twig-linter

一个Craft CMS模块,将`sserbin/twig-linter`引入Craft CMS项目

0.5.0 2024-08-15 11:46 UTC

This package is auto-updated.

Last update: 2024-09-15 11:56:54 UTC


README

一个Craft CMS模块,将 sserbin/twig-linter 引入Craft CMS项目

要求

此插件需要Craft CMS 5.0.0或更高版本。

安装

要安装模块,请按照以下说明操作。

  1. 打开您的终端并转到您的Craft项目

     cd /path/to/project
    
  2. 然后告诉Composer加载插件

     composer require studio-stomp/craft-twig-linter
    
  3. 在应用程序配置中加载模块

// File: ./config/app.console.php
return [
    'modules' => [
        // ... other modules
        'craft-twig-linter' => studiostomp\crafttwiglinter\CraftTwigLinter::class
    ],
    'bootstrap' => [
        // ... other module ids
        'craft-twig-linter'
    ],
];

Craft Twig Linter 概述

Craft Twig Linter通过以下方式工作

  • sserbin/twig-linter 实例化Symfony命令
  • 实例化一个用于运行命令的Symfony控制台应用程序
  • 为项目实例化一个WebApplication(模块在ConsoleApplication上下文中运行)
  • 聚合来自控制台和Web的所有已注册Twig扩展(由Craft插件和Craft模块注册)
  • 使用所有收集到的扩展创建一个新的Twig环境
  • 运行Symfony应用程序

配置Craft Twig Linter

目前,没有配置

使用Craft Twig Linter

    php craft craft-twig-linter/lint /path/to/templates /path/to/other/templates

Craft Twig Linter 路线图

一些要做的事情以及潜在功能的想法

  • 使模板路径可配置
  • 使模板路径自动发现
  • 使Symfony应用程序独立(PR sserbin/twig-linter 或分叉它)
  • 使其与Yii2兼容(如果与Yii2兼容,这也包括Craft吗?)

Studio Stomp 提供