PHP code example of bradstinson / assets

1. Go to this page and download the library: Download bradstinson/assets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bradstinson / assets example snippets


Assets::css('file1.css');
Assets::css('file2.css');

Assets::css(array('file1.css', 'file2.css'));

echo Assets::renderCss();
/*
Returns something like:
<link rel="stylesheet" href="/assets/cache/3cf89b9f723e22c1caf26f8d4d1fdc31.css">
*/

Assets::less('file1.less');

Assets::css(array('file1.less', 'file2.less'));

Assets::js('file1.js');
Assets::js('file2.js');

Assets::js(array('file1.js', 'file2.js'));

echo Assets::renderJs();
/*
Returns something like:
<script src="/assets/cache/9cf2803d8f075cb7d1ad31940738f35e.js"></script>
*/

Assets::coffee('file1.coffee');

Assets::coffee(array('file1.coffee', 'file2.coffee'));

echo Assets::render();
/*
Which will return:
<link rel="stylesheet" href="/assets/cache/3cf89b9f723e22c1caf26f8d4d1fdc31.css">
<script src="/assets/cache/9cf2803d8f075cb7d1ad31940738f35e.js"></script>
*/

Assets::setPath('public/assets/');

Assets::setBaseurl('/');