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:

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

Will output:

  1. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css">
  2. <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:

  1. 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:

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

Example using a cache and refresh:

  1. Assets::css([
  2. 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css',
  3. Url::templatePath().'css/style.css',
  4. ], 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. JDBC基础教程

    本文实例讲述了JDBC基础知识与技巧.分享给大家供大家参考.具体分析如下: 1.什么是JDBC? 通俗来讲JDBC技术就是通过java程序来发送SQL语句到数据库,数据库收到SQL语句后执行,把结果返 ...

  2. CF 560e Gerald and Giant Chess

    题意:在h×w的棋盘中从左上角走到右下角,只能向右或向下走,有n个点不可以经过,一共有多少种方案. 解法:dp.先对点按横坐标排序(横坐标相等按纵坐标,也可以反过来)dp[i]表示不经过其他非法点走到 ...

  3. ASDL + WN725N 配置无线AP

    1.  ASDL 正常拨号上网 2.  安装TP-LINK无线客户端应用程序 打开之后选择模拟AP 如下图设置----应用 3.  本地连接----属性----高级 如下图设置 4.  宽带连接--- ...

  4. Delphi word

    [转载]在Delphi中使用CreateOleObject方法 (2011-08-24 14:20:47) 转载▼ 标签: 转载   原文地址:在Delphi中使用CreateOleObject方法作 ...

  5. 利用文件实现Free Pascal中的简单排序功能

    此程序主要是验证文件功能的读写功能,总结到的东西有:①文件无论是读还是写,都要先建立链接关系才可以进行;②读与写不能同时进行,必须分开操作,这也可以理解,在实际鼠标操作时也是如此的!③读写后必须用cl ...

  6. 2014 多校联合训练赛6 Fighting the Landlords

    本场比赛的三个水题之一,题意是两个玩家每人都持有一手牌,问第一个玩家是否有一种出牌方法使得在第一回和对方无牌可出.直接模拟即可,注意一次出完的情况,一开始没主意,wa了一发. #include< ...

  7. [原创]使用命令行工具提升cocos2d-x开发效率(二)之CocosBuilder篇

    如果你正在使用CocosBuilder或者是其他基于CocosBuilder源码改装而成的工具为你的游戏搭建场景或者UI,那你一定要看看这篇文章:)   你是否已经厌倦了无聊的手工publish操作? ...

  8. viedeo

    http://download.farsight.com.cn/download/Android.htm

  9. hadoop hdfs的java操作

    访问hdfs上的文件并写出到输出台 /** * 访问hdfs上的文件并写出到输出台 * @param args */ public static void main(String[] args) { ...

  10. 集群搭建必备:虚拟机之一实现Host-only方式上网

    Host-only模式实现联网得考虑如下配置过程: 1. 安装VMware-Workstation,安装虚拟机Linux(centos.ubuntu等)完毕: 2.设置虚拟机上网方式是Host-onl ...