dorantes/laravel-pug
Composer 安装命令:
composer require dorantes/laravel-pug
包简介
Pug view adapter for Laravel 4
README 文档
README
A small package that adds support for compiling Pug (Jade) templates to Laravel via Pug.php. Both vanilla php and Blade syntax is supported within the view.
Installation
- Run
composer require dts/laravel-pug - Add the service provider to your app.php providers:
DTS\LaravelPug\ServiceProvider,
Configuration
All Pug.php config options are passed through via a Laravel config array.
- Publish the config file with
php artisan config:publish dts/laravel-pug --path=vendor/dts/laravel-pug/configand edit at /app/config/packages/dts/laravel-pug/config.php
Usage
Laravel Pug registers the ".pug", ".pug.php", ".pug.blade", and ".pug.blade.php" as well as the ".jade", ".jade.php", ".jade.blade", and ".jade.blade.php" extensions with Laravel and forwards compile requests on to Pug.php. It compiles your Pug templates in the same way as Blade templates; the compiled template is put in your storage directory. Thus, you don't suffer compile times on every page load.
In other words, just put your Pug files in the regular views directory and name them like "whatever.pug". You reference them in Laravel like normal:
View::make('home.whatever')forapp/views/home/whatever.pug
The Pug view files can work side-by-side with regular PHP views. To use Blade templating within your Pug, just name the files with ".pug.blade" or ".pug.blade.php" extensions.
Extending Layouts / Include Sub-views
Default root directory for templates is app/views, so from any template any deep in the directory, you can use absolute paths to get other pug files from the root: extends /layouts/main will extends the file resources/views/layouts/main.(pug|jade), include /partial/foo/bar, will include resources/views/partial/foo/bar.(pug|jade). You can use the basedir option to set the root to an other directory. Paths that does not start with a slash will be resolved relatively to the current template file.
Histoy
Read the Github project releases for release notes.
dorantes/laravel-pug 适用场景与选型建议
dorantes/laravel-pug 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 04 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dorantes/laravel-pug 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dorantes/laravel-pug 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-14