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的更多相关文章

  1. Config

    Config Config App Auth Cache Database Languages Mail Modules Routing Session Config Settings for the ...

  2. [asp.net core] Tag Helpers 简介(转)

    原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro What are Tag Helpers? ...

  3. 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 ...

  4. ASP.NET Core 中文文档 第四章 MVC(3.6.1 )Tag Helpers 介绍

    原文:Introduction to Tag Helpers 作者:Rick Anderson 翻译:刘浩杨 校对:高嵩(Jack) 什么是 Tag Helpers? Tag Helpers 提供了什 ...

  5. ASP.NET Core 中文文档 第四章 MVC(3.6.2 )自定义标签辅助类(Tag Helpers)

    原文:Authoring Tag Helpers 作者:Rick Anderson 翻译:张海龙(jiechen) 校对:许登洋(Seay) 示例代码查看与下载 从 Tag Helper 讲起 本篇教 ...

  6. [asp.net core]定义Tag Helpers

    原文地址 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring Getting started wi ...

  7. Yii2 assets注册的css样式文件没有加载

    准备引入layui.css文件的,在LayuiAssets类中已经配置了资源属性 <?php namespace frontend\assets; use yii\web\AssetBundle ...

  8. Liquid Exception: Included file '_includes/customizer-variables.html' not found in assets/bootstrap/docs/customize.html 解决方案

    执行下面这句话即可 rm -rf source/assets/bootstrap/docs/

  9. 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 ...

随机推荐

  1. 学习面试题Day08

    1.TCP/IP协议的理解.     TCP/IP定义了电子设备(如计算机)连入因特网的标准,以及数据如何在它们之间传输的标准.它既是互联网中的基本通信语言或协议,也是局域网的通信协议.     TC ...

  2. 转换时间为 “XX分钟之前”

    public static string getTimeAgo(string strDate) { string strTime = string.Empty; if (clsCommon.IsDat ...

  3. Codeforces 633D Fibonacci-ish 暴力

    题意:1000个元素,每个元素的大小-1e9<=a[i]<=1e9,然后让你重新安排这些元素的位置 获得最长的前缀斐波那契数列 分析:枚举第一个元素和第二个元素,因为在题目元素的范围内,最 ...

  4. extjs分组查询

    <script type="text/jscript"> var grid; Ext.onReady(function () { Ext.QuickTips.init( ...

  5. class0513(html基础加强)

    内容:HTML.CSS 目标:掌握手写HTML实现一般难度的Web页面的能力(如网站注册表单),为ASP.Net学习打基础.坚持手写HTML,可视化设计只是一种自学的手段. 参考书:张孝祥<Ja ...

  6. 五个小例子教你搞懂 JavaScript 作用域问题

    众所周知,JavaScript 的作用域和其他传统语言(类C)差别比较大,掌握并熟练运用JavaScript 的作用域知识,不仅有利于我们阅读理解别人的代码,也有助于我们编写自己的可靠代码. 下面笔者 ...

  7. Ubuntu 小技巧

    一.获得当前文件夹的路径: 在目标文件夹下,按Ctrl+l此文件的路径会被选中 之后Ctrl+c复制.要复制到终端(Terminal),选中终端按鼠标的滚轮就粘贴到了Terminal命令行中了. 二. ...

  8. 谈谈Nginx有哪些特点

    1.热部署        我个人觉得这个很不错.在master管理进程与worker工作进程的分离设计,使的Nginx具有热部署的功能,那么在7×24小时不间断服务的前提下,升级Nginx的可执行文件 ...

  9. 避免Java应用中NullPointerException的技巧和最佳实践

    Java应用中抛出的空指针异常是解决空指针的最好方式,也是写出能顺利工作的健壮程序的关键.俗话说"预防胜于治疗",对于这么令人讨厌的空指针异常,这句话也是成立的.值得庆幸的是运用一 ...

  10. mybatis代码生成器配置文件详解

    mybatis代码生成器配置文件详解 更多详见 http://generator.sturgeon.mopaas.com/index.html http://generator.sturgeon.mo ...