定制 heimrichhannot/contao-encore-bundle 二次开发

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

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

heimrichhannot/contao-encore-bundle

Composer 安装命令:

composer require heimrichhannot/contao-encore-bundle

包简介

This bundle brings deep integration for symfony encore into contao. On the one hand, your can prepare your bundles to define own webpack entries, which added with just one command to your webpack entries. On the other hand, this bundle allows you to add encore entries only on the pages you need the

README 文档

README

Latest Stable Version Total Downloads CI Coverage Status

Use the power and simplicity of symfony webpack encore in contao. This bundle let you decide on layout and page level, which encore entries should be loaded. If you want more, you can prepare your bundles define their own encore entries, so never need to manually add or remove encore entries again.

Features

  • use symfony encore (symfony/webpack-encore and symfony/webpack-encore-bundle) to enhance your contao assets workflow
  • conditionally load your assets only if necessary (entrypoints can be activated in the backend in layout and page setting or added from your bundle code (e.g. in a frontend module))
  • prepare your bundles to add encore entries when install them and strip assets from the contao global asset arrays

Setup

Prerequisites

  • Read the Encore Documentation in order to install Encore and understand the core concepts of Webpack and Symfony Encore.

Prepare your project and bundle

Setup your project for encore bundle:

➡️ Project setup

➡️ Bundle setup

Run Encore

  1. Run encore prepare command

    php vendor/bin/contao-console huh:encore:prepare
    
  2. If (yarn) dependencies have changed, run yan install

    yarn install
    
  3. Run encore to generate the assets

    yarn encore dev
    
  4. Activate encore entries in the contao backend (if not added from code)

Usage

Activate encore entries

  1. In the contao backend, go to page layout configuration
  2. Check "Activate Webpack Encore" and fill the mandatory fields
  3. If you have a main project bundle entry containing the main stylesheets, add it as active entry, add also all other entries you want to have activated on every page.
  4. For page specific features, you can activate additional entries in page setting (site structure).
    • Be aware, that child pages will inherit settings from their parants
    • Pay attention that you check entries as active (if you want them to be loaded)!
    • If you want an already added entry to be not loaded on an specific page, select it as entry and don't check "active".

Prepare command

php vendor/bin/contao-console huh:encore:prepare

The prepare command must be executed after every change to the encore entries configuration, e.g. after a composer update or changes to that configurations in your own code.

The command collect encore entries from all bundle and creates a file called encore.bundles.js in your project root. This file contains entries for all contao encore compatible bundles that are added by calling encoreBundles.addEntries(); in your webpack.config.js.

It also collects the dependencies from the package.json files of bundles have EncoreExtensions registered and adds them to the project dependencies.

Description:
  Does the necessary preparation for contao encore bundle. Needs to be called after changes to bundle encore entries.

Usage:
  huh:encore:prepare [options]
  encore:prepare

Options:
      --skip-entries[=SKIP-ENTRIES]  Add a comma separated list of entries to skip their generation. [default: false]

Run encore

Run encore to generate/compile your assets.

yarn encore dev 
yarn encore dev --watch 
yarn encore prod

Documentation

Project setup - Prepare your contao project for use with encore and encore bundle

Bundle setup - Add encore bundle support to your bundle

Setup Javascript - Help about setting up your encore entries

Developer Documentation

Configuration Reference

heimrichhannot/contao-encore-bundle 适用场景与选型建议

heimrichhannot/contao-encore-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.64k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2018 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 heimrichhannot/contao-encore-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2018-03-23