定制 catchdigital/drucker 二次开发

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

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

catchdigital/drucker

Composer 安装命令:

composer create-project catchdigital/drucker

包简介

Docker + drupal composer stack

README 文档

README

Introduction

Docker compose kick-starting set.

Set up

  • NGINX: Latest from docker hub.
  • PHP 7-fpm: Optimized version 7.4.4
  • Percona: Version 5.7

Create a the project

Create a new project with composer. Replace the ${project_name} with your project. That will be the root directory of your application: composer create-project catchdigital/drucker ${project_name}

If the settings.php file is updated in Drupal core, you'll need to uncomment the last 3 lines of settings.php to include the settings.local.php

Updating the project

An .env file should be created as a copy of .env.example. Feel free to add/update any variables as your needs.

Run docker compose docker-compose up -d server

If you have the domain in your hosts file, you should be able to hit the site on https://vm.localhost/ or whatever domain you want to run the site.

Other useful commands

Stop docker stack docker-compose stop

Destroy the whole docker stack. This also delete the database. docker-compose down

Next steps

Install the contrib themes if needed, create your custom theme, and update webpack with your ${theme} name.

After that, you should be able to build the css and javascript from the root of the project: npm run build. That will generate the files in a build folder in the theme. Don't forget to create add the build files to your libraries and create different entrypoints for each of your libraries, so they can be splitted around the twig templates.

In oder to add dynamically the dependencies for each entrypoint, you should add the following hook to your theme.

/**
 *
 * Implements hook_library_info_alter() for webpack chunks dependencies.
 */
function hook_library_info_alter(&$libraries, $extension) {
  // We only want to modify current theme extensions
  if ($extension === '${theme}') {
    // Load chunks dependencies from stats file.
    $stats = file_get_contents(DRUPAL_ROOT . "/../webpack.stats.json");
    $stats = Json::decode($stats);
    // Create and attach code splits.
    foreach($stats['namedChunkGroups'] as $name => $lib) {
      // Loop through require files.
      $reqAssets = $lib['assets'];
      if (isset($libraries[$name])) {
        $libraries = addNewLibrary($libraries, $reqAssets, $name);
      }
    }
  }
}

function addNewLibrary($libraries, $reqAssets, $name) {
  foreach($reqAssets as $asset) {
    $requireLib = str_replace('.bundle.js', '', $asset['name']);
    // Dependency exists?
    if (empty($libraries["asset-$requireLib"])) {
      $filename = "build/" . $asset['name'];
      $libraries["asset-$requireLib"] = [
        "js" => [
          $filename => []
        ]
      ];
      $excludedLibraries = ["500", "396"];
      if (in_array($requireLib, $excludedLibraries)) {
        $libraries["asset-$requireLib"]["js"][$filename] = [
          "minified" => false,
          "attributes" => [
            "async" => true,
            "defer" => true
          ]
        ];
      }
    }
    if (isset($libraries[$name]['dependencies'])) {
      $libraries[$name]['dependencies'][] = "${theme}/asset-$requireLib";
    } else {
      $libraries[$name]['dependencies'] = ["${theme}/asset-$requireLib"];
    }
  }
  return $libraries;
}

The individual library for each entry point must be created manually based on the definition on webpack, and they shuold use the same name. If using catchify theme, this is happening automatically.

catchdigital/drucker 适用场景与选型建议

catchdigital/drucker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 110 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-05