Welcome Guest, Not a member yet? Register   Sign In
Assets Spark - Progress
#1

[eluser]Boris Strahija[/eluser]
I'm working on the 1.0 version of the Assets spark and I would really like some feedback Wink

http://forrst.com/posts/Assets_CodeIgnit...ogress-V34
https://github.com/bstrahija/assets

Thanks
#2

[eluser]JonoB[/eluser]
The biggest problem with the last version is that you could not define actions for each asset. I would prefer that you can specify minimise and combine for each individual asset.

Code:
<?php Assets::css(array(
  array(
    array(
      'file' => 'init.css',
      'combine' => true,
      'min' => true
    ),
    array(
      'file' => 'style.css',
      'combine' => false,
      'min' => true
    ),
)); ?>

It would be even better if you could do the same for groups.
#3

[eluser]Boris Strahija[/eluser]
I don't think this makes sense for individual files, but I'll consider it for groups. I'm trying to keep it as simple as possible.
#4

[eluser]Boris Strahija[/eluser]
It is possible now to define minification/combining per group. Actually it was possible before, I just found a bug when both options were set to false, so it should be ok now.

Code:
<?php
Assets::clear_cache();

Assets::css(array(
  'app.css',
  'libs/jquery.fancybox.css',
));

Assets::css_group('test', array(
  'group.css',
  'test.css',
), array(
  'combine_css' => false,
  'minify_css'  => true,
));

Assets::js(array(
  'libs/jquery-1.7.2.min.js',
  'libs/bootstrap-tooltip.js',
));

Assets::js_group('head', array(
  'libs/jquery.fancybox.js',
  'plugins.js',
  'script.js',
), array(
  'combine_js' => false,
  'minify_js'  => true,
));
?>
#5

[eluser]JonoB[/eluser]
Nice!

Quick question: how much extra overhead is there to check each file modification date against cache file date? If its significant, then it would be nice to create an option to skip checks - i.e. if you have already created cache files, then just use them, and never check individual files.
#6

[eluser]Boris Strahija[/eluser]
Actually the overhead is not noticeable at all, since the function filemtime() is being cached by the server as far as I know.

The checks could be skipped, but since there are many different types of configuration possible, some sort of check would always be necessary, because the lib would have to know somehow which files from the to use in which position. It would be easy when combining is enabled, and there are only the 2 default groups, but otherwise with custom groups, prefixes, I don't think it would be that simple.

A quick solution for the CSS part is to user @import in a single CSS file, this way only 1 file would be checked. Some kind of include mechanism for JS would be nice to achieve the same thing in JS files.
#7

[eluser]Boris Strahija[/eluser]
Another idea is to integrate CoffeScript support. What do you think?




Theme © iAndrew 2016 - Forum software by © MyBB