inthra-onsap / InthraOnsap-Carabiner by inthra.onsap

To use minify js and css files (Extra Feature: you can put the php code in Javascript file.)
29
3
1
Package Data
Maintainer Username: inthra.onsap
Maintainer Contact: inthra.onsap@gmail.com (inthra.onsap)
Package Create Date: 2014-05-09
Package Last Update: 2017-10-21
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-08 03:15:02
Package Statistics
Total Downloads: 29
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 3
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0
/*
|--------------------------------------------------------------------------
| Style Directory
|--------------------------------------------------------------------------
|
| Path to the style directory.
| Relative to the public-Folder
|
*/
'styleDir' => '/',
/*
|--------------------------------------------------------------------------
| Cache Directory
|--------------------------------------------------------------------------
|
| Path to the cache directory. Must be writable.
| Relative to the public-Folder
|
*/
'cacheDir' => 'cache/',

/*
 * Base url for file location.
 */
'base_uri' => URL::to('/').'/',

/*
|--------------------------------------------------------------------------
| Combine
|--------------------------------------------------------------------------
|
| Flags whether files should be combined. Defaults to TRUE.
|
*/
'combine' => TRUE,


/*
|--------------------------------------------------------------------------
| Development Flag
|--------------------------------------------------------------------------
|
|  Flags whether your in a development environment or not. Defaults to FALSE.
|
*/
'dev' => FALSE,

/*
|--------------------------------------------------------------------------
| Minify Javascript
|--------------------------------------------------------------------------
|
| Global flag for whether JS should be minified. Defaults to TRUE.
|
*/
'minify_js' => TRUE,

/*
|--------------------------------------------------------------------------
| Minify CSS
|--------------------------------------------------------------------------
|
| Global flag for whether CSS should be minified. Defaults to TRUE.
|
*/

'minify_css' => TRUE,

/*
|--------------------------------------------------------------------------
| Force cURL
|--------------------------------------------------------------------------
|
| Global flag for whether to force the use of cURL instead of file_get_contents()
| Defaults to FALSE.
|
*/

'force_curl' => FALSE,

/*
|--------------------------------------------------------------------------
| Predifined Asset Groups
|--------------------------------------------------------------------------
|
| Any groups defined here will automatically be included.  Of course, they
| won't be displayed unless you explicity display them ( like this: Carabiner::display('jquery') )
| See docs for more.
|
*/
'groups' =>  array(),

/**
 * character encoding for javascript tag.
 * Default: UTF-8
 */
'charset' => 'UTF-8',

/**
 * Choose a compiler for javascript file.(It works once you use Carabiner::compileJs())
 * Options: php | blade
 * ex. php
 *      alert("<?php echo 'print some text'; ?>");
 * ex. blade
 *      alert("{{{ print some text }}}");
 * Default: php
 */
'compiler' => 'php'

);

/**

  • Add CSS file to queue
  • @param String of the path to development version of the CSS file. Could also be an array, or array of arrays. (ex. "assets/css/layout.css")
  • @param String of the media type, usually one of (screen, print, handheld) for css. Defaults to screen.
  • @param String of the path to production version of the CSS file. NOT REQUIRED
  • @param Boolean flag whether the file is to be combined. NOT REQUIRED
  • @param Boolean flag whether the file is to be minified. NOT REQUIRED
  • @param String of the group name with which the asset is to be associated. NOT REQUIRED
  • @return Void */ Carabiner::css($dev_file, $media = 'screen', $prod_file = '', $combine = TRUE, $minify = TRUE, $group = 'main')

/**

  • Adding js file to queue with blade or php compiler.
  • @param string $dev_file is String of the path to development version of the JS file. Could also be an array, or array of arrays. (ex. "assets/js/jquery.js")
  • @param type $args is Array of variable that you want to send to js view. (ex. array("name"=>"Inthra Onsap")).
  • @param string $prod_file is String of the path to production version of the JS file. NOT REQUIRED
  • @param type $combine is Boolean flag whether the file is to be combined. NOT REQUIRED
  • @param type $minify is Boolean flag whether the file is to be minified. NOT REQUIRED
  • @param type $group is String of the group name with which the asset is to be associated. NOT REQUIRED
  • @return Void */ Carabiner::compileJs($dev_file, $args = array(), $prod_file = '', $combine = TRUE, $minify = TRUE, $group = 'main'){

// Display css Carabiner::display('css');

//display js Carabiner::display('js');

// display both Carabiner::display(); // OR Carabiner::display('both');

// display group Carabiner::display('jquery'); // group name defined as jquery

// display filterd group Carabiner::display('main', 'js'); // group name defined as main, only display JS

// return string of asset references $string = Carabiner::display_string('main');

// clear css cache Carabiner::empty_cache('css');

//clear js cache Carabiner::empty_cache('js');

// clear both Carabiner::empty_cache(); // OR Carabiner::empty_cache('both');

// clear before a certain date Carabiner::empty_cache('both', 'now'); // String denoting a time before which cache // files will be removed. Any string that // strtotime() can take is acceptable. // Defaults to 'now'.