uncgits/uncgtheme-laravel
Composer 安装命令:
composer require uncgits/uncgtheme-laravel
包简介
UNCG Theme - responsive PHP wrapper
README 文档
README
author: Matt Libera (matt.libera@uncg.edu)
Introduction
This package makes the UNCG standard wrapper (based on Bootstrap) available to be used in Laravel. This package is designed to be used internally at UNCG for web application development.
Based on the UNCG responsive wrapper, August 2018 revision: https://its.uncg.edu/web-services/templates/
Version History
1.8
- Changes for PSR-4
1.7.3
- Attempts to fix a lingering reference to Trade Gothic font
1.7.2
- Override
.fadeopacity setting from the UNCG Assets back toinitialso that modals in the new Bootstrap version work again..
1.7.1
- Update Bootstrap and FontAwesome assets (and dependencies)
- Sniff application environment setting before applying Google Analytics
1.7
Replaces Trade Gothic font in rincuncg/css/common.min.css with new Pluto Sans
1.6 update
As of version 1.6 the package now works for both the "official" TLD method of installing Laravel, and also the symlink method of installing Laravel. Previously, this package would function in both environments, but if you created the app one way and tried to deploy it another (for instance, developed at http://myapp.local and then tried to deploy to https://myserver.uncg.edu/myapp), the symlinked assets would break.
If you are upgrading from a previous version and need this functionality, recreate the symlink by doing the following:
cdto your app's rootrm public/vendor/uncg/wrapper/rincuncgphp artisan uncgtheme:setup-symlinks- Commit your changes and push to repo
Installation
1. Require the package in composer.json
Run composer require uncgits/uncgtheme-laravel from the command line
2. Register service provider (Laravel 5.4 and below only)
The Service Provider will be auto-discovered if using Laravel 5.5+, but if using 5.4 or below, add the following to your providers list in config/app.php:
Uncgits\Uncgtheme\UncgthemeServiceProvider::class,
3. Complete theme installation
After installing the package, run the following artisan command:
php artisan uncgtheme:install- this will runphp artisan uncgtheme:publish-assetsandphp artisan uncgtheme:setup-symlinks- you could also run these individually.
Read below if you want to know more about what these commands do, specifically.
4. Configure the theme
Inside of config/uncgtheme.php, set up the variables to be used for the theme. You are provided with Blade templates and example optional components as part of the theme installation - many need to be activated in the config/uncgtheme.php file before they will be used, though. Read the comments in that file for more information.
Using the theme
First ensure that the theme configuration (Step 4 above) is done. You will want to make sure your nav menu Blade file name is inserted into views.nav if different from default CCPS Core.
Deploying on Single pages
If you want to use the wrapper in place of CCPS Core's default bootstrap wrapper, simply replace the following:
@extends('layouts.wrapper', [
'pageTitle' => 'Whatever'
])
with:
@extends('uncgtheme::layouts.wrapper', [
'pageTitle' => 'Whatever'
])
Using the Unit Head
The Unit Head area injects information defined in the config/uncgtheme.php file into the theme as a header. However, this can be cumbersome to do on all pages, so the theme accepts a showUnitHead variable when you extend it via Blade. So, if you want to show the unit head, you would use:
@extends('uncgtheme::layouts.wrapper', [
'pageTitle' => 'Whatever',
'showUnitHead' => true
])
Deploying on Entire site
If you want to use this theme on your entire site, rearrange your layouts.wrapper file to call the UNCG Theme wrapper itself (passing in both pageTitle and showUnitHead, recommend using the null coalesce operator on the latter), as follows:
// /resources/views/layouts/wrapper.blade.php
@extends('uncgtheme::layouts.wrapper', [
'pageTitle' => $pageTitle
'showUnitHead' => $showUnitHead ?? false
])
// whatever.blade.php - using unit head
@extends('layouts.wrapper', [
'pageTitle' => 'Whatever
'showUnitHead' => true
])
If you do this, best-practice would be to rename your original layouts.wrapper view to something like wrapper-bs4.blade.php so that you can use it as needed by calling @extends('layouts.wrapper-bs4')
Thin header version
The August 2018 version of the UNCG Responsive Website Assets contianed extra classing to be able to utilize a thin header instead of the full University header. This theme package supports the thin header by simply including a different view:
@extends('uncgtheme::layouts.wrapper-thin', [
'pageTitle' => 'Whatever'
])
This can be done as above for either single-page or entire-site deployments.
Publishing views
If you want to use your own views instead of the package views, call vendor:publish --provider=Uncgits\Uncgtheme\UncgthemeServiceProvider --tag=views and the views will be published to the resources/views/uncg/ folder.
Package updates
As of now all updates are contained within the package's vendor folder and the symlinked rincuncg assets. No updates should be necessary to published content.
Removing the theme
From the command line, you may remove the public/vendor/uncg folder by running the php artisan uncgtheme:remove-assets. This will leave your config file and Blade files.
Optionally, if you wish to remove ALL files, including the config and Blade files, you can run php artisan uncgtheme:remove-assets --all. Note that this will (obviously) blow away any changes you've made to the config file or customizations to the Blade template.
Artisan commands in detail
The artisan commands in the package function as follows:
php artisan uncgtheme:publish-assets- this will put the files from the various locations in the package into your project: essential wrapper files are placed intopublic/vendor/uncg/wrapper, placeholder JS and SASS files for overrides are placed intouncg/assetsanduncg/viewsin yourresources/viewsfolder, and theuncgtheme.phpconfig file is placed into theconfigfolder.php artisan uncgtheme:setup-symlinks- this completes the setup of the UNCG responsive wrapper assets (linking from yourpublicfolder into thevendorfolder). Arincuncgsymlink will be created inpublic/vendor/uncg/wrapperwhich links to therincuncgfolder inside of the composer assets. This helps Laravel to reference certain components of the wrapper even if they are not housed in thepublicfolder. (These are also the assets that will be updated as the UNCG wrapper is updated, and so they need to be housed invendoras part of the package).php artisan uncgtheme:remove-assets- as described above, this removes the published wrapper assets frompublic/vendor/uncgwith option to also remove the config file and views/assets from the theme folder.
Known issues
No currently known issues at time of release.
Questions
Contact me with any issues. Work is ongoing!
uncgits/uncgtheme-laravel 适用场景与选型建议
uncgits/uncgtheme-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 89 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 uncgits/uncgtheme-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 uncgits/uncgtheme-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 89
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-26