承接 bubobox/assets 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bubobox/assets

Composer 安装命令:

composer require bubobox/assets

包简介

Assets is a static class that makes it very easy to add javascript or stylesheets to your views.

README 文档

README

alt text

Assets

Assets is a static class that makes it very easy to add javascript or stylesheets to your views.

Run unit tests

composer install --dev
cd tests
phpunit

Usage

To specify a script or stylesheet to load from your controller your can use following code:

use \BuboBox\Assets as Assets;
Assets::js('modules/asset/assets/script.js');
Assets::css('modules/asset/assets/style.css');

Now in your view you can add the script and link tags for the resources using the Assets::render method as follow:

echo Assets::render(false, true); // Output only link (stylesheet) tags
echo Assets::render(true, false); // Output only script tags
echo Assets::render(true, true); // Output both link and script tags

For better examples take a look in the examples folder.

Asset loading order

You can assign a weight order to assets that you add using the second argument in the js and css method. The higher the number the earlier in the source the asset will be loaded.

Assets::js('modules/asset/assets/script1.js'); // Loaded third
Assets::js('modules/asset/assets/script2.js', 200); // Loaded first
Assets::js('modules/asset/assets/script3.js', 100); // Loaded second

If you don't specify the order weight then the default will be used and that is 0.

Modifiers

With a modifier callback function you can change the URLs of the assets before it's rendered into HTML. This can be handy if you for example want to load the .debug.js versions of your JavaScript files when your working in your development environment.

echo Assets::render(true, false, function($url) {
	return str_replace('.min.js', '.js', $url);
});

统计信息

  • 总下载量: 2.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固