承接 ibertrand/magento2-terser 相关项目开发

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

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

ibertrand/magento2-terser

最新稳定版本:v0.0.8

Composer 安装命令:

composer require ibertrand/magento2-terser

包简介

A Bash script that minifies JavaScript files in a Magento installation

README 文档

README

A Bash script that uses terser to minify your JavaScript files and can be run in the root directory of your Magento 2 installation.

The script will minify all JavaScript files in the pub/static/frontend directory of your Magento 2 installation, except for those that are already minified or the requirejs-bundle-config.js file. The minification tasks can be run in parallel for increased performance.

Installation

You can install the package using Composer. Run the following command in your terminal:

composer require ibertrand/magento2-terser

Alternatively, you can download the file minify-m2-scripts.sh directly and save it wherever you want.

The script requires the terser command to be available. If you don't have it installed, you can install it globally with npm:

npm install terser -g

If you don't have npm installed, you need to install it first.

Usage

To run the script, open a terminal in the root directory of your Magento 2 installation and run:

vendor/bin/minify-m2-scripts.sh

This is assuming you installed the package using Composer. If you downloaded the file directly, you need to run the script with the full path to the file.

By default, the script will minify all JavaScript files in the pub/static/frontend directory of your Magento 2 installation, except for those that are already minified or the requirejs-bundle-config.js file.

The original files will be replaced with the minified versions. If your M2 instance is in developer mode, this might alter files outside of the pub/static/frontend directory because of symlinks.

You can run the script with the -v or --verbose flag to display the name of each file that is being minified. Alternatively, you can run it with --no-progress-bar or with --silent, which includes --no-progress-bar.

Parallel execution

The script supports parallel execution of minification tasks to speed up the process. To specify the number of jobs to run in parallel, you can use the -j option followed by the number of jobs or --jobs= followed by the number of jobs.

For example, to run 3 jobs in parallel, you could use either of the below commands:

vendor/bin/minify-m2-scripts.sh -j3
vendor/bin/minify-m2-scripts.sh -jobs=3

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-08