Friendly Machine: Headless Drupal? It Just Might Be a Bigger Deal than Twig

Planet Drupal - Mon, 2014/08/04 - 10:21pm

If you're a frontend developer or designer that has grumbled about the challenges of Drupal theming, you no doubt applauded the announcement that the Twig template framework was being added to Drupal 8.

It's a big upgrade, no question. If you're like me, however, you may prefer a completely custom frontend crafted out of HTML, CSS and JavaScript. You may have looked at the cool stuff AngularJS or Backbone is capable of and wondered how you could bridge the gap with Drupal to enjoy that sort of freedom.

Fortunately, there are some folks that are already doing exactly that and sharing the results of their work. It's something called "headless Drupal" and it's an approach that uses Drupal as a backend content repository and REST server.

A REST server makes it possible for other applications to read and update data. The typical case is that Drupal is used to store and manage content and it then provides that data to your app built with Angular, Backbone, Ember, or whatever.  If that's not entirely clear, don't worry. The links below will help sort it out.

Headless Drupal Resources

Headless Drupal Manifesto - This is great place to start. It succinctly answers the question of why anyone would want to do this sort of thing.

Headless Drupal Group - A group on Drupal.org devoted to sharing ideas, discussion and experiments around the topic of headless Drupal.

Build a Drupal-free theme with 8's REST API and JavaScript - A presentation from DrupalCon Austin on building an AngularJS site that uses Drupal for the backend.

Headless Drupal, One form at a time - This is a great post from Amitai Burstein that demonstrates some of what this approach has to offer for the creation of frontend user interfaces.

Headless Drupal - Inline edit - Another good one from Amitai.

Here’s Drupal - Tonight on the Tonight Show with Jimmy Fallon - A case study of headless Drupal in action on a very high profile site.

If you know of some other resources, please share them in the comments below. I'd love to check them out.

Categories:

Nikro: Moldcamp 2014 - a late review

Planet Drupal - Mon, 2014/08/04 - 5:00pm

I know, it's been a while since the event took place (17th-18th of May), I was pretty busy and had a lot of stuff to do meanwhile, so I finally found a couple of hours to make a small review.

Tags: 
Categories:

Microserve: Coding in the Cloud

Planet Drupal - Mon, 2014/08/04 - 11:39am

An old timer like myself couldn't help but be filled with trepidation when it was revealed I'd be acting as the company guinea pig to give cloud based development a viability road test on my latest project.

No matter how cool I played it, the momentary panic at the thought of working without the tried and tested 'REAL' software apps installed on my macbook, must have been visible on my face.

You'll have to pry my favourite text editor out of my cold dead hands!

I've been used to the same comfy workflow for the last few years.

A local environment comprising of the same trusty text editor/IDE, a LAMP stack running on MAMP and code versioning using GIT. There was just something about 'cloud based coding' that didn't seem to ring true.

Pause For Thought

Then when i really thought about it, I began to examine just how much of my professional and personal life had already drifted into the cloud and in most cases for the better.

Thanks to Google, Dropbox and Apple amongst others, my email, calendars, notepads, files, photos, videos and documents have for the most part been in the cloud for ages. Do I miss opening up MS Word to write a letter? No.

Then I thought about how much easier life as a Drupal developer had become since adopting tools like Drush, Git and more recently, the Pantheon platform. (in essence 'cloud' based tools themselves.) So, thinking about it, cutting the last few remaining ties to local, machine specific workflow seemed less of an imposition and more like the next natural step in the evolution of web development.

Where to start?

After a bit of googling 'cloud based IDE', you'll see there's already quite a few choices. Most seem to follow a similar basic subscription paradigm (one or a number of free public projects and a paid for plan for private/production projects.)

In most cases they provide a fully functioning text/code editor with text highlighting support, basic options for uploading, renaming and deleting files, a cloud based LAMP stack, some kind of terminal or command line and a selection of optional 'plugin' tools.

Roadtest

I've been testing Codio: https://codio.com/

The site I've been working on is a Drupal 7 site that arrived with us, half built.

Codio handled the import of the existing database and files without much hassle and pulled in the code base via Git.

I was able to install drush as a Codio ‘part' (plugin) and was installing essential modules via Codio's command line terminal in no time.

There's a nice file tree in the left pane and the editor itself is a real pleasure to use.

I was impressed to find text highlighting support for SASS/LESS out of the box and it had decent poke at autocomplete of attributes.

There's a handy tab in the main menu which opens your project 'box' in a new tab or window and on a decent sized screen, it's pretty easy to get a nice comfortable layout with your code in one window and the running site in another.

One of the best things about Codio is that all changes to code are instant, with no saving or incremental Git commits needed. You only need to refresh your site to see it update.

Once you've done a tranche of work you're happy with, you can commit as you normally would, either using the in-built terminal or the GUI menus.

Conclusion

By the end of day one I had been totally sold. The feeling of freedom was, well.. liberating. The next day I had to set up a new mac to use at work, and usually this process eats up half a day of downloading latest versions of software, configuring, chasing licences etc. In this case I literally just turned on the new laptop, installed my browser of choice, logged into Codio and I was away!

Of course, with everything, there are some niggles. The most obvious downside to cloud based development is, that when your connection is spotty or you suffer an outage, you're immediately incapacitated. A few days in and the Codio servers themselves had a few hours of intermediate drop outs. You can imagine how frustrating this might be if you were riding up close to a deadline.

But on the whole the good far outweighed the bad and I'm sure that service and reliability is only going to improve as web based coding becomes the norm... Which i'm now convinced it will before too long.

Pros and Cons of Web Based Development Pros
  • Code anywhere that has a connection
  • Collaborate more easily with other developers
  • No local apps needed other than a browser
  • Platform agnostic (Makes things like Chromebooks slightly more viable as a stripped down development machine)
  • Less chance of incompatible files being shared between collaborators
  • Fewer problems for code team Sysadmins.
Cons
  • Reliant on reliable internet connection and host server
  • Basic file, folder housekeeping can be a bit laborious.

*I should point out that my experiences are with Codio IDE, but there are many other alternatives available. Cloud 9 seems to be proving very popular for instance.
You can find a rundown of some of the most popular here:
http://www.hongkiat.com/blog/cloud-ide-developers/

Categories: