Grav 0.9.0 Released

Another major milestone reached...

4 mins

Just over a week and a half after we made our beta 0.8.0 release available to the public, we are very pleased to announce the release of our latest 0.9.0 beta release. This is one of our biggest updates ever, and it contains lots of goodies! Read on to find out about what this release contains, and how the changes could potentially impact you!

Some more details of functionality we added are contained in the Grav Roadmap, but you can check out the Changelog for a complete list.

One of the biggest new additions for this release, and something we have wanted to implement for a while, is our new Dependency Injection Container. This replaces the simple Registry system we used in our prior versions. This allows us easily access all the elements of Grav easily, but more importantly, it allows us to easily override or replace parts of Grav dynamically. An example of this might be that we can easily add support to store data in an alternative data-store if we wished. It also allows us to set up relationships between all our Grav objects, making Grav that much more powerful.

Another key feature is the implementation of a proper Event Dispatcher for interaction with plugins. This allows our plugins to register themselves with the Event Dispatcher for increased flexibility and performance. Also we have renamed all our events to align better with the preferred syntax for the dispatcher.

Plugin developers and theme designers will greatly appreciate our custom Asset Manager which makes it really easy to register JavaScript and CSS assets from your themes and plugins. Using the Asset Manager, you can add these assets and even assign them an ordering priority. The benefits are a simplified mechanism, but more importantly, we are now able to turn on Asset Pipelining to combine, minify, and optimize both JavaScript and CSS assets into a single unified file, resulting in smaller downloads and less HTTP requests.

The addition of File Stream Wrappers allow us to provide more flexible overrides of locations, and help Grav become more extensible. We now have a new streams.yaml configuration that can be customized to easily extend the stream capabilities.

Some other requested, and very useful, additions for this release include the ability to turn on Markdown Extra support either globally or per-page. Markdown Extra provides some great enhancements to Markdown such as inline HTML, Markdown inside HTML blocks, assigning of CSS attributes such as class and ID to markdown elements, definition lists, and footnotes. We have also added media syntax directly in the markdown tags. This lets you take advantage of Grav's powerful media handling with simple markup, for example: ![Sample Image](sample-image.jpg?cropZoom=400,100).

We have also added a new random sort order for collections, as well as the ability to set the Tracy Debugger to auto-detect your environment. This way you can easily have the debugger enabled in your local development setup, but disabled in production. Another new feature is the Browser object which is available in code and Twig templates to identify specific browser properties such as platform and version.

Important Changes from 0.8.0

Because this is such a big release, there is a potential for some issues if you have built a site on version 0.8.0:

Changes to Themes

The main change to themes is that we have moved to a new Asset Management system. This means that for plugins to properly output their associated JavaScript and CSS, you must call the Asset Manager to output the relevant data it has registered. Also, you should update your theme assets to use this new asset manager syntax. An example of this can be seen in the latest version of the AntiMatter theme:

{% block stylesheets %}
    {% do assets.addCss('theme://css-compiled/nucleus.css',102) %}
    {% do assets.addCss('theme://css-compiled/template.css',101) %}
    {% do assets.addCss('theme://css/font-awesome.min.css',100) %}
    {% do assets.addCss('theme://css/slidebars.min.css') %}

    {% if page.header.lightbox %}
        {% do assets.addCss('theme://css/featherlight.min.css') %}
    {% endif %}

    {% if browser.getBrowser == 'msie' and browser.getVersion >= 8 and browser.getVersion <= 9 %}
        {% do assets.addCss('theme://css/nucleus-ie9.css') %}
        {% do assets.addCss('theme://css/pure-0.5.0/grids-min.css') %}
        {% do assets.addCss('theme://js/html5shiv-printshiv.min.js') %}
    {% endif %}

    {{ assets.css() }}
{% endblock %}

{% block javascripts %}
    {% do assets.addJs('theme://js/jquery-2.1.1.min.js',101) %}
    {% do assets.addJs('theme://js/modernizr.custom.71422.js',100) %}
    {% do assets.addJs('theme://js/nova-theme.js') %}
    {% do assets.addJs('theme://js/slidebars.min.js') %}

    {% if page.header.lightbox %}
        {% do assets.addJs('theme://js/featherlight.min.js') %}
    {% endif %}

    {{ assets.js() }}
{% endblock %}

As you can see this is much cleaner now, and much more flexible.

Changes to Plugins

Plugins have changed quite a bit in this release. With the new DI container, the asset manager, updated event names etc, the process of writing a plugin is similar but quite a few things are different. We strongly advise you to check out the Plugin Tutorial, along with the documentation on the new Event Hooks to get a better idea on how the changes may impact you if you have written a custom plugin.

View the commit differences between 0.8.0 and 0.9.0

So, what are you waiting for? Please check out Grav for yourself! Or join us on Freenode IRC #grav.

Grav Premium
Turbo-charge your Grav site - from the creators of Grav