承接 lastcall/mannequin-drupal 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lastcall/mannequin-drupal

Composer 安装命令:

composer require lastcall/mannequin-drupal

包简介

Drupal extension for the Mannequin template viewer

README 文档

README

Mannequin Drupal is brought to you by your friends at Last Call Media, it is a command line application that you can use to visualize and work on your Drupal Twig Templates in the browser. For example, you might use it to work on the templates inside of an existing custom theme.

Quick Start

Using Composer, install Mannequin Drupal from your project root. From the command line:

$ composer require lastcall/mannequin-drupal

Next, create a new .mannequin.php file in your project root. This file is where you will configure Mannequin. Inside of that file:

<?php
// .mannequin.php
use LastCall\Mannequin\Core\MannequinConfig;
use LastCall\Mannequin\Drupal\DrupalExtension;
use Symfony\Component\Finder\Finder;

// Describe where to find Drupal templates.
// See https://symfony.com/doc/current/components/finder.html
$drupalFinder = Finder::create()
    // Templates can live in your normal templates directory.
    ->in(__DIR__.'/themes/mytheme/templates')
    ->files()
    ->name('*.twig');
    
$drupalExtension = new DrupalExtension([
    'finder' => $drupalFinder,
    'drupal_root' => __DIR__,
]);

return MannequinConfig::create()
  ->addExtension($drupalExtension)
  ->setGlobalJs([
    // themes/mytheme/js/theme.js  
  ])
  ->setGlobalCss([
    // themes/mytheme/css/theme.css
  ]);

See all of the configuration options, or view an example project

Setting up Components

While the .mannequin.php file tells Mannequin where to find your components, you still need to describe them to Mannequin. To do that, we use a special YAML formatted comment block at the top of your twig files. For example, to describe a "Card" component living inside of card.html.twig, you would add the following at the top of the file:

{# @Component
name: Card
group: Molecule
samples:
    Small:
        title: I am a small card
        body: Lorem ipsum...
        classes: ['small']
#}
<div class="{{ classes|join(' ') }}">
  ... 
</div>

See the full YAML reference here

Workflow

When you're ready to begin work on your templates, you can use the following worklow:

  1. Fire up a live development server so you can see your component. From the command line:
    $ vendor/bin/mannequin start
  2. This will output a URL for the Mannequin UI. Visit it in your browser.
  3. In the UI, find the component you want to work on.
  4. Open the file, and make your changes.
  5. Reload the UI to see how your changes look.

统计信息

  • 总下载量: 10.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固