Open hammat opened 11 years ago
Casset renders each group only once, by disabling a group after it's been rendered. This means you must be adding the same file to the same group multiple times? Yeah I can see that going wrong. I think I'd prefer to prevent the second instance of the file being added to the group, if that makes sense?
Yes, the file is hadded several times in the same group (js by default). I had a look in add_asset to do it inside but because of multidimensional arrays, I didn't wanted to make the code too complex.
I can have another look if you want. Still it might be more overkill.
Hmm? I was thinking of something along the lines of
if (in_array($files, static::$groups[$type][$group]['files']))
return;
around about line 555?
Hey sorry mate for my late answer. It's a way nicer solution you have, I agree.
It looks like your in_array condition works properly when added just before the array_push.
if (!in_array($files, static::$groups[$type][$group]['files']))
array_push(static::$groups[$type][$group]['files'], $files);
When using Casset in partials, it renders the same file several times. Then it causes conflicts for javascript.
Shouldn't Casset render only once each file to avoid these conflicts?