pug-php/pug-assets

1.1.4 2021-05-02 15:34 UTC

This package is auto-updated.

Last update: 2024-08-29 04:42:53 UTC


README

Latest Stable Version Build Status StyleCI Test Coverage Code Climate

管理您的资源和第三方转译器(less、stylus、coffee、babel等),并允许您在生产环境中进行合并和/或压缩。

安装

首先,如果您还没有,需要安装composer: https://getcomposer.org.cn/download/

然后在您的项目根目录下,打开终端并输入

composer require pug-php/pug-assets

启用插件

use Pug\Assets;
use Pug\Pug;

$pug = new Pug();

// The facade syntax:
Assets::enable($pug);
$pug->render('... minify ...'); // here you can use minfiy, assets or concat keywords to wrap your assets

Assets::disable($pug);
$pug->render('... minify ...'); // here minfiy, assets or concat are simple tags again

// Or the instanciation syntax:
$assets = new Assets($pug);
$pug->render('... minify ...'); // here you can use minfiy, assets or concat keywords to wrap your assets

unset($assets);
$pug->render('... minify ...'); // here minfiy, assets or concat are simple tags again

有关concat/minify使用的更多信息,请参阅https://github.com/pug-php/pug-minify#readme

Pug-Assets 还安装了coffee、react-jsx、stylus、less和markdown pug过滤器,以使用它们作为内联内容。