Helpers\Assets
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:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="http://novaframework.dev:8888/templates/default/assets/css/style.css" rel="stylesheet" type="text/css">
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);
Helpers\Assets的更多相关文章
- Config
Config Config App Auth Cache Database Languages Mail Modules Routing Session Config Settings for the ...
- [asp.net core] Tag Helpers 简介(转)
原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro What are Tag Helpers? ...
- BEST FREE UNITY ASSETS – OVER 200 CURATED QUALITY ASSETS
http://www.procedural-worlds.com/blog/best-free-unity-assets-categorised-mega-list/ BEST FREE UNITY ...
- ASP.NET Core 中文文档 第四章 MVC(3.6.1 )Tag Helpers 介绍
原文:Introduction to Tag Helpers 作者:Rick Anderson 翻译:刘浩杨 校对:高嵩(Jack) 什么是 Tag Helpers? Tag Helpers 提供了什 ...
- ASP.NET Core 中文文档 第四章 MVC(3.6.2 )自定义标签辅助类(Tag Helpers)
原文:Authoring Tag Helpers 作者:Rick Anderson 翻译:张海龙(jiechen) 校对:许登洋(Seay) 示例代码查看与下载 从 Tag Helper 讲起 本篇教 ...
- [asp.net core]定义Tag Helpers
原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring Getting started wi ...
- Yii2 assets注册的css样式文件没有加载
准备引入layui.css文件的,在LayuiAssets类中已经配置了资源属性 <?php namespace frontend\assets; use yii\web\AssetBundle ...
- Liquid Exception: Included file '_includes/customizer-variables.html' not found in assets/bootstrap/docs/customize.html 解决方案
执行下面这句话即可 rm -rf source/assets/bootstrap/docs/
- com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK assets/com.xx.xx
完整的Error 信息(关键部分) Error:Execution failed for task ':fanwe_o2o_47_mgxz_dingzhi:transformResourcesWith ...
随机推荐
- 排序算法(C#)
1.插入排序 1.1直接插入排序 算法介绍: 直接插入排序(straight insertion sort)的做法是: 每次从无序表中取出第一个元素,把它插入到有序表的合适位置,使有序表仍然有序. ...
- Android视图SurfaceView的实现原理分析
http://blog.csdn.net/luoshengyang/article/details/8661317
- linu、C语言、计算机基础教程
Linux操作系统入门教程:http://see.xidian.edu.cn/cpp/linux/ 鸟哥的linux私房菜:http://vbird.dic.ksu.edu.tw/ 计算机操作系统教程 ...
- WebOb的简单介绍
在之前的文章中我写了有关于如何使用PasteDeploy生成WSGI的Application.在Openstack的源码中,除了 PasteDeploy外,还有一个和WSGI密切相关的工具包WebOb ...
- shell ftp上传下载文件
1. ftp自动登录批量下载文件. #####从ftp服务器上的/home/data 到 本地/home/databackup#### #!/bin/bash ftp -n<<! open ...
- phpMyAdmin导入本地数据库
phpMyAdmin导入本地数据库 在PHPMyAdmin导入数据时,点击导入--执行后出现错误: 您可能正在上传很大的文件,请参考文档来寻找解决方法. 可能就是因为数据库太大的原因. 那么如何 才能 ...
- AVD Snapshot功能
写程序的时候,经常会碰到:The application has stopped unexpectly… 有时候,会想对原来软件增加新功能或者修改bug.在eclipse修改后保存代码(注意,要保存所 ...
- Ios学习
http://www.cnblogs.com/superhappy/archive/2013/04/23/3038493.html http://www.360doc.com/content/14/0 ...
- 关于Windows文件名和路径名的那些事
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:关于Windows文件名和路径名的那些事.
- js获取上传文件内容(未完待续)
js 获取上传文件的字节数及内容 <div> 上传文件 : <input type="file" name = "file" id = &qu ...