A Huzz wrote on Saturday 11th of June 2011:I'm planning to use your library on my project and wondering how do you manage assets files in different locations for example mulitple theme dirs?
Antony Male wrote on Saturday 11th of June 2011:A Huzz wrote on Saturday 11th of June 2011:I'm planning to use your library on my project and wondering how do you manage assets files in different locations for example mulitple theme dirs?
Current it behaves exactly the same as Asset in this respect. You add the paths you want Casset to search through to the 'paths' config variable, and Casset will search through those and grab the first matching asset it finds. So in your instance you'd add "themes/default/" and "themes/admin/" to the paths array. I'm not entirely happy with this approach however (you're taking something that's nicely namespaced, and stripping all of that out -- what happens if you have two files called 'index.js' and want to include the second?). I'm entirely open to suggestions as to the best way to handle this.
A Huzz wrote on Saturday 11th of June 2011:thanks for your quick response, if you have identical files can you not place them with the same dir structure in the cache dir? so you will have cache/theme1/js/index.js and cache/theme2/index.js.
Casset::js('admin::index.js')would work? I don't want the user to have to specify the whole path to the file -- including the 'js/' bit -- as Casset is able to work that out.
'paths' => array( 'admin' => 'assets/themes/admin/' ),And then invoke this path with the syntax used above? What do you think?
Antony Male wrote on Saturday 11th of June 2011:A Huzz wrote on Saturday 11th of June 2011:thanks for your quick response, if you have identical files can you not place them with the same dir structure in the cache dir? so you will have cache/theme1/js/index.js and cache/theme2/index.js.
Currently, no. This is a flaw that the original Asset library shares. Check back on Monday, however, and I'll try and have something written in. Do you think a syntax likeCasset::js('admin::index.js')would work? I don't want the user to have to specify the whole path to the file -- including the 'js/' bit -- as Casset is able to work that out.
Maybe make the paths array associative, so you can specify this (in your config file)'paths' => array( 'admin' => 'assets/themes/admin/' ),And then invoke this path with the syntax used above? What do you think?
It looks like you're new here. If you want to get involved, click one of these buttons!