tilpark/webpack-loader

PHP核心webpack加载器

v1.2.1 2021-01-11 17:52 UTC

This package is not auto-updated.

Last update: 2024-10-02 10:05:23 UTC


README

webpack加载器消费由webpack-bundle-tracker生成的输出,并允许你在PHP中使用生成的包。

安装

composer require tilpark/webpack-loader

使用

use Tilpark\Webpack\Loader;
// Give the main directory where the asset is located as parameter.
$loader = new Loader(__DIR__);

// getBundle (extension, entry)
// example.com/assets/bundles/main.[hash].js
$jsBundlde = $loader->getBundle('js', 'main');
$cssBundle = $loader->getBundle('css', 'main');

选项

手动设置PublicPath

$loader->setPublicPath("http://192.168.1.99/assets/bundles/");