Building a Drupal 8 Theme. with new-fangled awesomeness



Similar documents
IBM Digital Experience. Using Modern Web Development Tools and Technology with IBM Digital Experience

MODERN WEB APPLICATION DEVELOPMENT WORKFLOW

Creating a Drupal 8 theme from scratch

Continuous Integration and Delivery. manage development build deploy / release

jenkins, drupal & testing automating every phing! miggle

Learning Web App Development

Grunt, Gulp & fabs. Build-System and Development-Workflow for modern Web-Applications

Drupal CMS for marketing sites

Everything you ever wanted to know about Drupal 8*

Web Developer Toolkit for IBM Digital Experience

SUHAIL DAWOOD Toronto, Ontario

Drupal for Designers

Responsive UX & UI Front End Developer

Simple Tips to Improve Drupal Performance: No Coding Required. By Erik Webb, Senior Technical Consultant, Acquia

A Baseline for Web Performance

Drupal and ArcGIS Yes, it can be done. Frank McLean Developer

Data Management Applications with Drupal as Your Framework

DRUPAL CONTINUOUS INTEGRATION. Part I - Introduction

GETTING STARTED WITH DRUPAL. by Stephen Cross

Getting Started Developing JavaScript Web Apps. this = that. VT Geospatial Forum 2015

JavaScript Programming

HOW TO CREATE THEME IN MAGENTO 2

How To Fix A Bug In Drupal 8.Dev

Modern Web Development:

Andrew Kovalenko Full Stack Web Developer

Overview: Technologies:

DevOps Course Content

Drupal 8 rocks! (but our CSS & HTML sucks.) Drupal 8 ( CSS HTML )

CoffeeScript and Drupal. Mark Horgan

Behavioral Driven Development with Behat

Achieving Continuous Integration with Drupal

CLASSROOM WEB DESIGNING COURSE

Four Reasons Your Technical Team Will Love Acquia Cloud Site Factory

for Modern Web Design Andy Blanchard / Chris Keller

Figure 1 responsive grid system for all view ports, from desktops, tablets and smart phones

Drupal Module Development

WE BUILD ONLINE SYSTEMS USEFUL WEB & MOBILE APPLICATIONS

How To Write A

CREDENTIALS DOCUMENT. T M E. info@visionfactor.com.au W.

Responsive Web Design for Drupal

Continuous Integration

MASTER DRUPAL 7 MODULE DEVELOPMENT

HTML5, The Future of App Development

Tech Radar - May 2015

Personal Profile. Experience. Professional Experience

Building Web Applications

Volkov Vyacheslav. Summary. Saransk, , Mordovia, Russian Federation Moscow, Russian Federation +7(925)

Migrating into Drupal 8

Responsive Web Design Creative License

Multi-touch app development with modern web tools. David Reagan, Advanced Visualization Lab

Republic Polytechnic School of Infocomm C308 Web Framework. Module Curriculum

Automate Your Deployment with Bamboo, Drush and Features DrupalCamp Scotland, 9 th 10 th May 2014

Agile Web Application Testing

Building Rich Internet Applications with PHP and Zend Framework

Mike Laurel. Web Developer UI / UX Engineer.

Theming on Drupal 7. Working with Omega s Responsive Framework

Abdullah Radwan. Target Job. Work Experience (9 Years)

Ultimate Skills Checklist for Your First Front-End Developer Job

This Record of activity confirms that Jonathan Scrase has completed the following courses within the Microsoft Virtual Academy:

How To Change Your Site On Drupal Cloud On A Pcode On A Microsoft Powerstone On A Macbook Or Ipad (For Free) On A Freebie (For A Free Download) On An Ipad Or Ipa (For

JavaScript Client Guide

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

CURRICULLUM VITAE Piotr Kołodziejczyk

AJAX Toolkit Framework

Creating Value through Innovation MAGENTO 1.X TO MAGENTO 2.0 MIGRATION

Copyright by Object Computing, Inc. (OCI). All rights reserved. AngularJS Testing

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Auditing Drupal sites for performance, content and optimal configuration

Certified PHP/MySQL Web Developer Course

Title: Front-end Web Design, Back-end Development, & Graphic Design Levi Gable Web Design Seattle WA

Workshop on Using Open Source Content Management System Drupal to build Library Websites Hasina Afroz Auninda Rumy Saleque

Evaluation. Chapter 1: An Overview Of Ruby Rails. Copy. 6) Static Pages Within a Rails Application

GOVERNMENT SERVICES. Open Source Software Development Web Content Management Mobile + Web Apps

A (Web) Face for Radio. NPR and Drupal7 David Moore

DESIGN RESPONSIVELY DRUPAL CAMP CT RESPONSIVE WEB DESIGN AND DRUPAL PROJECT. Monday, August 27, 12

Paul Boisvert. Director Product Management, Magento

Fast track to HTML & CSS 101 (Web Design)

Mastering Magento Theme Design

A BASELINE FOR WEB PERFORMANCE WITH PHANTOMJS

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

GUI and Web Programming

Lucy Zhang UI Developer Contact:

Christopher Hill. Web Architect. HTML5, CSS3, Javascript, AngularJS NodeJS (Express), Ruby (Rails), Python (Django)

Entites in Drupal 8. Sascha Grossenbacher Christophe Galli

Skills for Employment Investment Project (SEIP)

AVOIDING THE GIT OF DESPAIR

WEB AND APPLICATION DEVELOPMENT ENGINEER

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

Transcription:

Building a Drupal 8 Theme with new-fangled awesomeness

Marc Drummond (& Izzy) @MarcDrummond marcdrummond.com mdrummond IRC & drupal.org

I m writing a book! Drupal 8 Responsive Web Design Packt Publishing Photo by Jalal Hameed Bhatti, Flickr

Surprise! There are new things in Drupal 8 (and front-end in general) Photo by Michelle Tribe, Flickr

I get totally overwhelmed by all the new things. I feel like I know nothing. Me. (And everyone else) Photo by Andrés Þór, Flickr

Are any of these things unfamiliar? info.yml Git Composer Drush Twig Handlebars Mustache Web components HAML libraries.yml Assetic config.rb Bootstrap Foundation Web Starter Kit Zen Grids Singularity Susy require.js Coffee Script AMD CommonJS Backbone Underscore.js Ember Angular Ruby RVM Bundler Gemfile Gemfile.lock Bower bower.json Node npm package.json Composer composer.json AcquiaDev Desktop MAMP Homebrew Vagrant Docker Chef Puppet Yeoman Grunt Gruntfile.js Gulp Gulpfile.js Lint csslint jshint eslint uglifyjs Autoprefixer imageoptim Grunticon Style Prototypes Pattern Lab KSS TDD BDD Behat Casper.js BrowserStack Wraith Pageres Selenium PhantomJS SlimerJS Jenkins TravisCI It s ok.

Let s start with themes. So what is a theme? Photo by Boa-Franc, Flickr

Your theme Is that your final answer? HTML CSS JS Media (images) Photo by Dave Malkoff, Flickr

All your YML and PHP belongs to us. Drupal theme files

Theme information and settings THEME.info.yml Photo by Christian Ostrosky, Flickr

Theme information and settings THEME.info.yml name: 'Atomic' type: theme engine: twig description: 'Base theme based on atomic design principles.' core: 8.x stylesheets: all: - css/styles.css settings: atomic_typekit_id: '0'

Theme settings theme-settings.php Photo by Charles Roffey, Flickr

Theme settings theme-settings.php <?php /** * Implements hook_form_system_theme_settings_alter() function. * * @param $form * Nested array of form elements that comprise the form. * @param $form_state * A keyed array containing the current state of the form. */ function atomic_form_system_theme_settings_alter(&$form, $form_state) {! ////////////////////////////// // Miscelaneous //////////////////////////////! $form['typography'] = array( '#type' => 'fieldset', '#title' => t('typography'), '#description' => t('typography settings for your theme.'), '#collapsible' => FALSE, '#collapsed' => FALSE );! $form['typography']['atomic_typekit_id'] = array( '#type' => 'textfield', '#title' => t('typekit Kit ID'), '#default_value' => theme_get_setting('atomic_typekit_id'), '#size' => 7, '#maxlength' => 7, '#description' => t('if you are using <a href="!link" target="_blank">typekit</a> to serve webfonts, put your Typekit Kit ID here', array('!link' => 'https://typekit.com/')), );! }

Settings files THEME.settings.yml Photo by Christian Ostrosky, Flickr

Settings files THEME.settings.yml # @todo There is no UI yet for configuring this, but the setting is included # here, because ConfigImportUITest requires a non-empty bartik.settings.yml # file: https://drupal.org/node/2235901. shortcut_module_link: false

Setting schema files THEME.schema.yml Photo by Peter Lee, Flickr

Setting schema files THEME.schema.yml # Schema for the configuration files of the Bartik theme.! bartik.settings: type: theme_settings label: 'Bartik settings' mapping: # @todo Module-specific settings should be defined by the module: # https://drupal.org/node/2235901. shortcut_module_link: type: boolean label: 'Shortcut module link'

Theme config defaults other.stuff.yml Photo by Justin de la Ornellas, Flickr

Theme config defaults other.stuff.yml id: theme.bartik.bartik name: bartik label: Bartik breakpoint_ids: - theme.bartik.mobile - theme.bartik.narrow - theme.bartik.wide source: bartik sourcetype: theme status: true langcode: en

Let s look at How do Drupal 8 themes work with? HTML CSS JavaScript

Turning data into markup HTML Photo by Adrian, Flickr

Theme functions & preprocess THEME.theme Photo by Sunova Surfboards, Flickr

Theme functions & preprocess THEME.theme <?php! /** * Implements hook_page_alter() */ //function atomic_page_alter(&page) {! function atomic_page_alter(&$page) {! ////////////////////////////// // Add in TypeKit Code. ////////////////////////////// if (theme_get_setting('atomic_typekit_id')) { $kit_id = theme_get_setting('atomic_typekit_id'); $kit_url = "//use.typekit.net/". $kit_id. ".js"; $kit_try_catch = "try{typekit.load();}catch(e){}"; // $kit = array(); $page['#attached']['js'][] = array('type' => 'external', 'data' => $kit_url, 'every_page' => TRUE); $page['#attached']['js'][] = array('type' => 'inline', 'data' => $kit_try_catch, 'every_page' => TRUE); // drupal_render($kit); } }

Twig: Templates that make sense TEMPLATE.html.twig Photo by Scott Moore, Flickr

Twig: Templates that make sense TEMPLATE.html.twig <!DOCTYPE html> <html{{ html_attributes }}> <head> {{ page.head }} <title>{{ head_title }}</title> {{ page.styles }} {{ page.scripts }} </head> <body{{ attributes }}> <a href="#main-content" class="visually-hidden focusable skip-link"> {{ 'Skip to main content' t }} </a> {{ page_top }} {{ page.content }} {{ page_bottom }} {{ page.scripts('footer') }} </body> </html>

Psst Other templating tools Handlebars Mustache Web components HAML

Managing stylesheets and scripts CSS/JS assets Photo by Ricymar Photography, Flickr

Managing dependencies for CSS and JS THEME.libraries.yml Photo by Samantha Marx, Flickr

Managing dependencies for CSS and JS THEME.libraries.yml base: version: VERSION css: theme: css/layout.css: {} css/style.css: {} css/colors.css: {} css/print.css: { media: print }! maintenance_page: version: VERSION css: theme: css/maintenance-page.css: {} dependencies: - system/maintenance

Tool for managing CSS and JS Assetic Photo by MorkiRo, Flickr

Not just jquery anymore JavaScript all the things

JS tools Modernizr Underscore CoffeeScript

Fun with JS frameworks Backbone Ember Angular (MVC for Javascript)

JS module loaders AMD CommonJS JS script loaders require.js curl.js

Sass, Compass and more CSS for fun and profit Photo by Ismael Celis, Flickr

Compass configuration config.rb Photo by Sunova Surfboards, Flickr

Compass configuration config.rb # Require any additional compass plugins here. require 'compass/import-once/activate' require 'compass-normalize' require 'toolkit' require 'breakpoint' require 'susy' require 'modular-scale' require 'color-schemer' require 'sassy-buttons'! # Default to development if environment is not set. saved = environment if (environment.nil?) environment = :development else environment = saved end! # In development, turn on the FireSass-compatible debug_info by default. firesass = (environment == :development)? true : false! # Location of the theme's resources. css_dir = "css" sass_dir = "sass" images_dir = "images" javascripts_dir = "js"! output_style = (environment == :development)? :expanded : :compressed relative_assets = true! # Conditionally enable line comments when in development mode. line_comments = (environment == :development)? true : false sass_options = (environment == :development && firesass == true)? {:debug_info => true} : {}

CSS Architecture OOCSS BEM SMACSS

CSS Frameworks Bootstrap Foundation Web Starter Kit

Grid Frameworks Zen Grids Susy Singularity New CSS layout tools Flexbox Regions Grids

Sassy Gems Breakpoint Toolkit Modular Scale Color Schemer Sassy buttons

But wait, there s more! Let s talk tools Photo by OZinOH, Flickr

Tools you probably want to use Command line Git Composer Drush (It s not all that scary. Really.)

Managing dependencies and packages Lean on me Photo by Marin, Flickr

PHP Composer composer.json

Front-end Bower bower.json

Node npm package.json

Ruby Ruby environment RVM rbenv Bundler: Ruby gems Gemfile Gemfile.lock

Setting up a local server, manage languages, etc. Dev environment tools Photo by Greyloch, Flickr

Dev environment tools MAMP/WAMP/LAMP/XAMPP Acquia Dev Desktop Homebrew Vagrant and Docker Chef and Puppet

Scaffolding tool to build files for themes or modules Yeoman Photo by Tom Francis, Flickr

Multiple command line tasks with one command Task runners Photo by Kyle Steed, Flickr

Task runners Grunt gruntfile.js Gulp gulpfile.js Node-based: npm install

What s a task runner without tasks? Fun with tasks Photo by Dan Coulter, Flickr

Lints csslint jslint eslint Minifiers uglifyjs Autoprefixer

Image tools imageoptim grunticon Other tasks shell contrib-copy

Building in the browser with component-based design Prototyping tools Pixel perfection is the enemy of the good. Photo by Enigma Badger, Flickr

Static prototypes Style tiles Element collages Visual inventories Style guide generators Style Prototypes Pattern Lab KSS

Tools for making sure your site works before deploying changes Testing & Deployment Photo by Pascal, Flickr

Cross-browser testing BrowserStack Screenshot tools Wraith Pageres Headless browsers PhantomJS SlimerJS

BDD Behat CasperJS Automated regression testing Selenium Continuous integration Jenkins Travis CI

Are you insane? Am I insane? Are we insane? Why do you vex me so? Photo by Robert McGoldrick, Flickr

Why so complicated? Collaboration Consistency Capabilities Automate mundane tasks Find errors, improve performance prior to deployment

I m scared. Hold me. Coping with madness

You don t have to do all of this. Ok to just use HTML, CSS and JS. Try one new thing with a project. Next project? Try another new thing. Or don t.

Photo by Erik Meldrum, Flickr

Photo by Laura, Flickr

Photo by Amburn Everett, Flickr

Marc Drummond (& Izzy) @MarcDrummond marcdrummond.com mdrummond IRC & drupal.org