03/02 2013
VHS 1.5.0 released

This new version contains the brand new Asset feature as well as a handful of new, useful ViewHelpers such as the Menu / Directory and List ViewHelpers and Video/Media objects as well as a DomainObject and DateTime compatible JSON encode and decode set of ViewHelpers.

Dear developers

Once again here are some good news. The Assets feature in VHS has been completed - and if you don't already know what it is, I suggest you read the <link internal-link internal link in current>Asset Management in Fluid article. Briefly described the Asset feature allows unprecedented control over Asset inclusions (CSS, JS, etc.) at the same time as allowing the inclusion to take place inside Fluid templates - of absolutely any kind (as long as it is rendered in the frontend, naturally).

The feature is tremendously easy to use:

<v:asset name="jquery" path="//some.com/cdn/url/jquery.js" />
<v:asset name="my-jquery-script" dependencies="jquery" path="path/to/script.js" />

And because it does not matter in which sequence the inclusions are performed, you can just as easily reverse the two lines - or place one in the Layout and another in a Partial template. Not only that - when enabled, even standalone Assets can be initially parsed using Fluid, with custom template variables assigned. The most recent version of fluidpages_bootstrap demonstrates this (and indeed, you can see the effect on this web site: the jumbotron display has colors, sizes and margins configurable in the page properties but use an external CSS file with Fluid variable markers as a template to create new, unique stylesheets. However, only one stylesheet is created per unique configuration of parameters so inherited template variables (see other news item about Fluid Pages being updated) do not create duplicated CSS files.

The new JSON encoding ViewHelper not only supports objects which usually would break JSON (DateTime, objects with getters/setters and protected/private properties) - it also supports DomainObjects and supports them recursively without breaking. It even has an option to place a fake object at locations where recursion occurs. A practical use case example which combines the power of VHS Assets and this JSON encoding ViewHelper (this is where things get interesting!):

<v:asset.script name="json-news">
    var newsList = {newsitems -> v:format.json.encode()};
</v:asset.script>
<v:asset.script name="uses-news-json" dependencies="json-news">
    alert('There are ' + newsList.length + ' news items in the list');
</v:asset.script>

The JSON representation is then stored in a separate file - it is even merged with the script chunk which uses it (because the standalone flag was not set). Like with every other Asset you can place the JSON encoded representation after the script chunk which uses it - the order doesn't matter as long as you use dependencies. Imagine having to create that manually... never again. And since Assets are connected to the caches: clearing the cache also rebuilds the Asset (indeed every Asset) from scratch.

That's about it. I certainly hope you enjoy using it as much as I enjoyed creating it. I know I will find it extremely handy in the future!

Cheers,
Claus

 

Archive

09/01 2017
09/11 2016
09/06 2016
21/12 2015
07/12 2015
25/11 2015
25/09 2015
22/09 2015
01/08 2015
10/03 2015
03/03 2015
12/02 2015
25/11 2014
01/11 2014
16/10 2014
02/10 2014
02/10 2014
19/09 2014
18/09 2014
05/09 2014
22/08 2014
02/08 2014
27/06 2014
06/06 2014
13/04 2014
27/03 2014
12/03 2014
11/03 2014
05/02 2014
25/01 2014
17/12 2013
08/12 2013
03/12 2013
04/11 2013
Flux 7.0 Teaser
06/08 2013
21/07 2013
10/06 2013
04/06 2013
01/06 2013
27/05 2013
19/05 2013
19/05 2013
11/05 2013
26/04 2013
30/03 2013
19/03 2013
17/03 2013
13/03 2013
10/03 2013
10/03 2013
05/03 2013
04/03 2013
03/03 2013
02/03 2013
01/03 2013
28/02 2013
27/02 2013
25/02 2013
24/02 2013
24/02 2013
23/02 2013
10/02 2013
03/02 2013
03/02 2013
27/01 2013
Asset management in Fluid
20/01 2013
16/01 2013
13/01 2013
08/01 2013
16/12 2012
25/11 2012
18/11 2012
08/11 2012
07/11 2012
05/11 2012
04/11 2012
28/10 2012
22/10 2012
14/10 2012
13/08 2012
08/08 2012
31/07 2012
30/07 2012
25/07 2012
29/04 2012
29/04 2012
22/04 2012
16/04 2012
21/03 2012
Flux 1.4.0 released
08/03 2012
Flux 1.3.0 released
04/03 2012
03/03 2012
28/02 2012
19/02 2012
A Sneaky Sneak Preview of the next version of Flux
13/02 2012
12/02 2012
06/02 2012
30/01 2012
27/01 2012
15/01 2012
26/12 2011
24/12 2011
11/12 2011
11/12 2011
10/12 2011
04/12 2011
04/12 2011
30/11 2011
26/11 2011
25/11 2011