Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

assets optimization

edited March 2015 in Bug Reports
Hi!
I got some problems with assets optimization:
tried to optimize assets by passing different values of $config['assets_output'] in MY_Fuel.php but have no results (actually no reaction at all), then i changed value of $config['assets_output'] in asset.php file, it did worked but my site broke down:
not all js scripts worked properly, not all backgrounds loaded, actually page cant fully load, compiled css and js files apear in assets/cache, but I gues it just didn't compile them fully or properly, in cache folder appears 4 php files one of them with header("Content-type: text/javascript; charset: UTF-8"); is 1kb...
About my assets:
css and js files are located in different subfolders, some of them are allready compiled (bootstrap.min.css, bootstrap.min.js)
I tried to remove jquery.js - same result...
Questions:
Compiler takes all files from
css('main').css($css); js('main').js($js)
this code or from assets directory?
What should I do to combine files, strip whitespace, and gzip them properly?

Comments

  • edited 8:52AM
    I would first start by trying to isolate if there is one or more files that are causing the problem. Perhaps just start with the main.css file and then add more. You'll need to clear out the cached files probably each time. A few more questions:

    1. What are the values of $css and $js.
    2. Are the js and css files located at assets/js/{file}.js and assets/css/{file}.css respectively?
    3. Are the image paths in your CSS set to be relative (e.g. ../images/{imgname.ext})
  • edited 8:52AM
    1. Values of $css and $js (in global.php):
    $vars['js'] = array( 'components/bootstrap', 'components/response', 'components/slider', 'components/filtr', 'components/popup', ); $vars['css'] = array( 'main', 'elem/header', 'elem/menu', ...... 'components/popup' );
    2. Files are located in assets/js/script.js , assets/js/{folder}/script.js, and css also have some subfolders.
    3. Images paths in css files are relative.
  • edited 8:52AM
    The CSS in subfolders may be an issue because it is putting it into one file and the relative path may be breaking. Are you able to do them one at a time to see how which file(s) may be causing the issue (remember to clear the cached files).
  • edited 8:52AM
    I moved all css and js files from subfolders to assets/css and assets/js respectively, changed relative paths in css files, removed all js files from global.php and connected them manually, when turn on optimization everything worked fine with css, but it refuses to compile js files: tried to connect them by one, every time cleare cache, but no metter what file(s) included in $vars['js'] result is the same - scripts are not working, file in chache is 1kb with error:
    Error(22): Too many compiles performed recently. Try again later.
  • edited 8:52AM
    That error is coming from the Google compiler (http://closure-compiler.appspot.com/compile) and they do meter the compiling. If you pass an array of parameters in the third parameter of your js() function call of array('js_minify' => FALSE), it won't try and minify the JS.
Sign In or Register to comment.