Welcome Guest, Not a member yet? Register   Sign In
AssetLibPro - An advanced CI Asset Library
#31

[eluser]Nicholas Hanks[/eluser]
I am new when it comes to AssetLib Pro. Do you have any knowledge of how implement this library. I followed instruction but nothing showed up in View file. Where Regular CSS and compress CSS needs to go. I have same question regarding Javascript as well. Please help me out.
#32

[eluser]a&w[/eluser]
[quote author="Nicholas Hanks" date="1225970653"]I am new when it comes to AssetLib Pro. Do you have any knowledge of how implement this library.[/quote]
Yes.

[quote author="Nicholas Hanks" date="1225970653"] I followed instruction but nothing showed up in View file.[/quote]
Nothing will magically show up in your view "file". You place code in the view file to have it generate the links, etc.

[quote author="Nicholas Hanks" date="1225970653"] Where Regular CSS and compress CSS needs to go. [/quote]
You specify where your assets are at in the config file.

[quote author="Nicholas Hanks" date="1225970653"]I have same question regarding Javascript as well. Please help me out.[/quote]
Why not post your controller method so someone can help you out? If you have used the proper code in your controller or view just make sure that you have modified the config file so correctly also so it can find your files.
#33

[eluser]Nicholas Hanks[/eluser]
This is what I did in controller
Code:
public function __construct()
{
  parent::Controller();
  $this->load->helper(array('html'));
  $this->load->model('Income');
  $this->load->library('assetlibpro');
  $this->config->load('assetlibpro');
  $this->assetlibpro->add_css(base_url().'css/index.css');
  $this->assetlibpro->add_css(base_url().'css/icon.css');
}
This is what I did in View File
Code:
<?php
echo $this->assetlibpro->output('all');
?>
This is how my assetlib config is
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* AssetLibPro - A CodeIgniter Asset Class
*
* @version of AssetLibPro:    1.0.5
*/

/*
|--------------------------------------------------------------------------
| Asset storage
|--------------------------------------------------------------------------
|
| The path to where to storage the joined assets.
| alp_cache_dir_css = "/assets/compressed/" (as example)
|
*/
$config['alp_asset_dir'] = '/assets/';//TRAILING SLASH!
$config['alp_cache_dir_css'] = '/assets/compressed/';//TRAILING SLASH!
$config['alp_cache_dir_js'] = '/assets/compressed/';//TRAILING SLASH!

/*
|--------------------------------------------------------------------------
| Asset default groups
|--------------------------------------------------------------------------
|
| This allows you set a default group adding assets without having to
| particularly specify the group on every "add_css()" or "add_js()"
|
*/
$config['alp_default_group_css'] = 'screen';
$config['alp_default_group_js'] = 'default';

/*
|--------------------------------------------------------------------------
| Toggle CSSTidy/JSMin Compression
|--------------------------------------------------------------------------
|
| Whether to run compression using csstidy or jsmin
|
*/
$config['alp_enable_csstidy'] = TRUE;
$config['alp_enable_jsmin'] = TRUE;

/*
|--------------------------------------------------------------------------
| Toggle GZip Compression
|--------------------------------------------------------------------------
|
| Whether to compression the output using gzip
|
*/
$config['alp_gzip_compress_css'] = FALSE;
$config['alp_gzip_compress_js'] = FALSE;

/*
|--------------------------------------------------------------------------
| Toggle Browser Caching
|--------------------------------------------------------------------------
|
| Whether to force the browser to cache the files
| (Even with caching enabled web browsers will still detect changes automatically!)
|
*/
$config['alp_force_cache_css'] = TRUE;
$config['alp_force_cache_js'] = TRUE;

/*
|--------------------------------------------------------------------------
| Alternative development server configuration
|--------------------------------------------------------------------------
|
| Allows you to use different settings for your development (localhost?) server
|
*/
$enable_dev_server_config = TRUE;
$dev_server_name = 'localhost'; //Replace "localhost" with your dev server name if needed or just use a custom conditional expression.
if ($_SERVER['SERVER_NAME'] == $dev_server_name && $enable_dev_server_config == TRUE) {
    $config['alp_enable_csstidy'] = TRUE;
    $config['alp_enable_jsmin'] = TRUE;
    
    $config['alp_gzip_compress_css'] = FALSE;
    $config['alp_gzip_compress_js'] = FALSE;
    
    //error_reporting(E_ALL);//Comment it out if not wanted.
}

/*
|--------------------------------------------------------------------------
| CSSTidy Config
|--------------------------------------------------------------------------
|
| The path from your site's root in which the csstidy folder is. Note
| this is from the site's root, not the file system root. Also note the
| required slashes at start and finish.
|
| csstidy_basepath = "/system/plugins/csstidy" (as example)
|
*/
$config['alp_csstidy_basepath']    = "/plugins/csstidy/";

$config['alp_csstidy_config'] = array(
                                  'remove_bslash' => TRUE,
                                  'compress_colors' => TRUE,
                                  'compress_font-weight' => TRUE,
                                  'lowercase_s' => FALSE,
                                  'optimise_shorthands' => 1,
                                  'remove_last_,' => TRUE,
                                  'case_properties' => 1,
                                  'sort_properties' => FALSE,
                                  'sort_selectors' => FALSE,
                                  'merge_selectors' => 2,
                                  'discard_invalid_properties' => FALSE,
                                  'css_level' => 'CSS2.1',
                                  'preserve_css' => FALSE,
                                  'timestamp' => FALSE
                                 );
$config['alp_csstidy_template'] = "highest_compression";

/*
|--------------------------------------------------------------------------
| JSmin Config
|--------------------------------------------------------------------------
|
| Enter the path to your jsmin.php file. (relative from BASEPATH)
|
| jsmin = "/system/plugins/jsmin1.1.1.php" (as example)
|
*/
$config['alp_jsmin']    = "/plugins/jsmin.php";

?>
Lastly Thanks a lot for your response. Please help me
#34

[eluser]a&w[/eluser]
And I assume the result is that no css file is attached and there is no link in your rendered html.

I'd set a breakpoint at the

Code:
$this->assetlibpro->add_css(base_url().'css/index.css');

line and see if it is finding your files.

I refactored this library and made some test methods. What that does is generate a report going through several checks on the asset library class so you can see how things are configured and what files it did and did not find. If you're interested in my version PM me your email address.
#35

[eluser]Nicholas Hanks[/eluser]
Thanks for the reply. Unfortunately setting a break point gives me no error. I am just curious where each directory needs to go like CSS, JAVASCRIPT, COMPRESS CSS, and COMPRESS JAVASCRIPT. I know you can set that up with config but I don't see the part where I can link for UNCOMOPRESSED regular CSS and Javascript.
#36

[eluser]a&w[/eluser]
It won't throw errors necessarily, hence why you need to step through and why I made it create an output test if requested. If you map it wrong you'll just end up with assets missing.
#37

[eluser]Nicholas Hanks[/eluser]
I was just curious where stuff goes or I would say better place to put stuff. Also how can I add assets in Lib. Seems like I am missing something here.
#38

[eluser]TheLoops[/eluser]
Nicholas I made a Google Project Page for AssetLibPro. It should explain all steps pretty clearly: http://code.google.com/p/assetlib-pro/wi...figuration
#39

[eluser]Nicholas Hanks[/eluser]
I have read the Wiki before but the instruction is not clear enough for me. For example it does not tell you where to put CSS and JS, also it does not tell you the default folder where it expects certain thing. AssetLib Pro library seems like it is awesome as per your description but I am having hard time to test it or implement it. Smile
#40

[eluser]TheLoops[/eluser]
It has no default folder for css or js and tus doesn't expect anything anywhere. Just give it the files' URLs.




Theme © iAndrew 2016 - Forum software by © MyBB