博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Helpers\Assets
阅读量:6860 次
发布时间:2019-06-26

本文共 1244 字,大约阅读时间需要 4 分钟。

Helpers\Assets

The assets helper is for loading CSS and JS files rather than writing out the full script/link tag for each and every item, instead add them to an array pass to the assets and it output the link/script tags for you.

Usage example for loading CSS files:

Assets::css([ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', Url::templatePath().'css/style.css', ]);

Will output:

Assets has 2 methods css and js, they can take a single value or an array of values.

Example of loading a single js file:

Assets::js(Url::templatePath().'css/app.js');

Both methods have additional parameters other than the file/s:

$cache Default set to false, when set to true the contents will be compressed and compiled into a single files placed within your theme css/js folder.

$refresh Default set to false, set to true to update the cache.

$cachedMins Time in seconds to hold the cache.

Example using a cache:

Assets::css([ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', Url::templatePath().'css/style.css', ], true);

Example using a cache and refresh:

Assets::css([ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', Url::templatePath().'css/style.css', ], true, true);

转载地址:http://hyxyl.baihongyu.com/

你可能感兴趣的文章
javascript怎么禁用浏览器后退按钮
查看>>
AtomicLong可以被原子地读取和写入的底层long值的操作
查看>>
Android studio 将 Module 打包成 Jar 包
查看>>
Java中抽象类和抽象方法的区别
查看>>
任务调度JOB
查看>>
有关通过web来发送东西的小记住
查看>>
mysql数据类型
查看>>
Elasticsearch系统配置及rest风格API
查看>>
Filter过滤器详解(转)
查看>>
第一章 起步
查看>>
socket和http有什么区别?
查看>>
vue+element刷新当前路由
查看>>
关于“机器人离线编程”国内外近三年的研究
查看>>
计算机网络
查看>>
[04]javascript的数据类型
查看>>
[CC-SEABUB]Sereja and Bubble Sort
查看>>
JS设置cookie、读取cookie、删除cookie
查看>>
我的博客园的CSS和html设置
查看>>
数论基础(维诺格拉多夫著,裘光明译) 勘误
查看>>
vue-cookies的使用
查看>>