canton7 / fuelphp-casset

Better asset management library for fuelphp (with minification!)
MIT License
103 stars 29 forks source link

Added twig extension #19

Closed dmyers closed 12 years ago

dmyers commented 12 years ago

What do you think?

canton7 commented 12 years ago

Thanks! I've made a couple of alterations, see the feature/twig branch. Can you test this?

One thing I suspect, is that the 'Casset_Addons_Twig', in parser/config.php will actually have to be '\Casset\Casset_Addons_Twig',, and similarly, the various classes in casset/addons/twig.php will have to be namespaced correctly.

dmyers commented 12 years ago

Awesome worked great. It worked without the \Casset namespace just like your readme has it. I did have to add some lines to the casset/addons/twig.php though like you said, I forgot I did mine in my app directory which has the aliases setup or something.

https://gist.github.com/2293009

canton7 commented 12 years ago

Does it work if you remove those use lines, but replace Twig_Extension and Twig_Function_Function with \Twig_Extension and \Twig_Function_Function respectively?

dmyers commented 12 years ago

Yeah it does. :) I just did that because of Fuel Parser's extension was like that and wasn't sure of your preference. :)

Updated: https://gist.github.com/2293009

canton7 commented 12 years ago

Aah, fair play. I'm following the style set by the rest of Casset, which was based on the Fuelphp style from that time. I'll look into whether Fuel have shifted their style overall, but that's a change which I'd like to apply to the whole of Casset at once.

I've pushed those updates to feature/twig -- can you give me one last check to make sure it's all working and bug-free please? Then I'll merge it in, and do a release.

dmyers commented 12 years ago

Grabbed latest an replaced my package. Works perfect! Thanks Antony!

dmyers commented 12 years ago

Whoops I meant to also add this one too: 'image_url' => new Twig_Function_Function('Casset::get_filepath_img'),

But it's not a huge deal though hah, maybe next release.

canton7 commented 12 years ago

Cool, I've just pushed v1.15 which includes this.

Thanks a lot for your help in getting this together! I've kept your name on the commit which creates addons/twig.php, and added you to the contributors list in the readme.

canton7 commented 12 years ago

Oops, only got your comment after I made the release.

I've added it to the develop branch. Let me know if you think of anything else, otherwise I'll do another release tomorrow or so.