Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2016-09-18 (1 month ago) ![RSS 2.0 feed](/graphics/phpclasses/rss2.png) | | Not enough user ratings | | Total: 152 This week: 1 | | All time: 8,156 This week: 1,047![Up](/graphics/phpclasses/up.png) |
|
Description | | Author |
This package can add common JavaScript and CSS assets to a Web page.
It can output HTML to load JavaScript libraries or CSS style sheets from common providers by a given name.
Currently it supports adding JavaScript and CSS files from Bootstrap and jQuery but it also supports adding assets from other vendors dynamically with a specific call or using traits. | |
![Picture of Gavin Gordon Markowski Picture of Gavin Gordon Markowski](/picture/user/1348645.jpg) |
|
Innovation award
![Innovation award](/graphics/phpclasses/innovation-award-logo.png) Nominee: 2x |
|
Details
AssetInc
![Build Status](https://travis-ci.org/gavinggordon/assetinc.svg?branch=v1.0.1)
This class (GGG\AssetInc\AssetInc) provides a simple and quick way to include/add JS or CSS assets to an HTML document's head and/or body.
Installation
composer require gavinggordon/assetinc
Examples
Instantiation:
include_once( __DIR__ . '/vendor/autoload.php' );
$JSasset = \GGG\AssetInc\AssetInc::init( 'js' );
$CSSasset = \GGG\AssetInc\AssetInc::init( 'css' );
JS:
$JSasset->insert( 'jquery' );
// Result: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
$JSasset->add_asset( ASSET_NAME, ASSET_URL );
$JSasset->insert( ASSET_NAME );
// Result: ASSET_URL
CSS:
$CSSasset->insert( 'font-awesome' );
// Result: <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
$CSSasset->add_asset( ASSET_NAME, ASSET_URL );
$CSSasset->insert( ASSET_NAME );
// Result: ASSET_URL
View this class package on PHPClasses.org.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.