trendsoft/themes

0.1.0 2017-12-26 08:43 UTC

This package is auto-updated.

Last update: 2024-04-29 03:44:39 UTC


README

主题管理,读取指定目录下的主题目录,并通过简单的方式获取对应主题的资源文件.

Build Status Latest Stable Version Latest Unstable Version StyleCI Scrutinizer Code Quality Code Coverage Build Status License Total Downloads Monthly Downloads Daily Downloads

要求

  • PHP >= 7.0
  • Composer

安装

$ composer require "trendsoft/themes" -vvv

使用示例

$theme = new Theme($config);
$theme->asset('app.js'); //获取资源
$theme->all(); //获取所有主题列表
$theme->path('assets/app.css'); //获取主题目录assets目录下的app.css文件

配置文件

return array('active' => 'default', 'paths'  => [ 'absolute' => $this->getAbsolute(), 'base' => 'themes', 'assets' => 'assets' ]);
  • active:默认使用的主题slug
  • paths:
    • absolute:绝对路径
    • base:主题目录uri相对路径
    • assets:资源目录

创建主题

在absolute对应的目录中创建一个以主题slug命名的目录,并在此目录中创建theme.json文件,theme.json文件格式如下:

{
  "slug": "bootstrap",
  "name": "Bootstrap",
  "author": "Jabber",
  "description": "is a bootstrap theme",
  "version": "0.1.0"
}

主题列表

$theme->all();

应用主题

$theme->active('vue'); //or $theme->setCurrent('vue');

Contribution

Contribution Guide

License

MIT