定制 ponbike/require-js-optimizer 二次开发

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

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

ponbike/require-js-optimizer

Composer 安装命令:

composer require ponbike/require-js-optimizer

包简介

Ponbike RequireJS Optimizer

README 文档

README

This module will implement the config-gen module created by WeareJH (see https://github.com/WeareJH/config-gen for details) in your deploy workflow and will only add the bundles when running in production mode.

Step 1 - Download the binary

Download the latest config-gen release from the WeareJH config-gen repository and store it in your project bin directory. Also

Step 2 - Edit the configuration file

Rename the require-js-optimizer-config.yaml.dist to require-js-optimizer-config.yaml and require-js-optimizer-bundle.yaml.dist to require-js-optimizer-config.yaml. Next edit the require-js-optimizer-bundles.yaml to fit your needs.

Step 3 - Collect the data

Next run the config-gen command:


Step 4 - Store the collected data in your project
---
When all pages are recorded download the recorded data:

`build.json`

The build.json data is used to run the requirejs optimizer command, store the contents of [http://localhost:12345/__bs/build.json]() to `require-js-optimizer-build.json` in your project root.

`loaders.js`

The loader.js data is used to load the bundle configuration for your theme, this file needs to be placed in the active theme and will only be included when the environment is running in production mode. Store the contents of [http://localhost:12345/__bs/loaders.js]() to your theme in the file `Ponbike_RequireJSOptimizer/web/js/requirejs-loader.js`

Step 5 - Install r.js
---
Run `npm install -g requirejs`. For further instructions see https://github.com/requirejs/r.js/blob/master/README.md.

Step 6 - Build the optimized bundles
---
Make sure to switch to production mode (`bin/magento deploy:mode:set production`), otherwise the bundle loader will not be included.

To optimize the RequireJS files, you first need to deploy the static content (`bin/magento setup:static-content:deploy`), when completed run the optimizer script: 

```bin/require-js-optimizer.sh```


Step 7 - Optional, only if you deploy to Magento Commerce Cloud / platform.sh
---
In order to run the optimizer during the deploy (in the build-phase) update your `.magento.app.yaml` (or `.platform.app.yaml`) file:

```
hooks:
    # We run build hooks before your application has been packaged.
    build: |
        set -e
        php ./vendor/bin/ece-tools build:generate
        bin/require-js-optimizer.sh
        php ./vendor/bin/ece-tools build:transfer
    # We run deploy hook after your application has been deployed and started.
    deploy: |
        php ./vendor/bin/ece-tools deploy
    # We run post deploy hook to clean and warm the cache. Available with ECE-Tools 2002.0.10.
    post_deploy: |
        php ./vendor/bin/ece-tools post-deploy
``` 

Also you need to disable the GZIP-ing of the static content during the ece-tools build:generate command, do disable the GZIP update the `.magento.env.yaml` file:

```
          stage:
            build:
              SCD_COMPRESSION_LEVEL: 0
```

ponbike/require-js-optimizer 适用场景与选型建议

ponbike/require-js-optimizer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36.47k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 ponbike/require-js-optimizer 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-09