an impress.js presentation by Tsachi Shlidor - use the spacebar or arrow keys to navigate

Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Advanced

Front end development

a presentation by Tsachi Shlidor (@shlidor)

ME

Tsachi Shlidor
Front-End developer @ linnovate.net
Maintainer of Sasson, Salsa and a few other projects.
@shlidor on twitter

What does that even mean ??

Being a pro Drupal FED, usually means you get to write code.
You want full control on your markup, styles and scripts. and no point-and-click UI will be able to give you such controll.

The big questions are:

How much code do you write ?

You should write as little code as possible, writing code takes time, that means more work - less fun.

How fast do you get there ?

You will have to write some custom code, don't waste too much time on that.

Are you constantly improving ?

Being a pro means following best-practices and always learning new stuff.

How much do you enjoy it ?

You should enjoy what you do, or at least minimize the hassle.

How?

Work faster

Not harder, Just faster.


The key is not doing more work, but achieving your goals faster.
This will leave you time for contributions, for self improvements and for more work, if you must.
Heck, you can even have a life!

Use Sass

or any other CSS pre-processor, or Sass.


Sass, with the SCSS syntax, is just like CSS on steroids, it looks like CSS but has tons of features that may make your work a lot easier and faster.

Quick example: mixins

instead of repeating yourself (DON'T) or putting all your styled containers in one place, you can have a mixin:

@mixin styled-container { margin: 5px 10px; padding: 15px 30px; border: 3px solid #999; @include border-radius(10px); color: #fff; background: #222; } // Header styles #header { @include styled-container; } // Footer styles #footer { @include styled-container; }

Use Drush


This applies not only to FEDs but to any pro-Drupalist.

Drush commands save you time. this may add up to save you hours of work, weekly.

Ever created a subtheme ?
Ever wanted to update a module ?

With Drush:
# Create a subtheme drush sns coolthemename # Update views drush up views

Immediate feedback

Don't refresh your browser ever again.

Slow
  1. Save your stylesheet.
  2. Alt-tab to go to your browser.
  3. Click refresh or F5.
  4. Wait for page to reload.
  5. See result.
Fast
  1. Save your stylesheet.
  2. See result.


Many tools provide this feature - it is built-in into Sasson, LiveReload, Live.js, WebStorm IDE and probably others too...

Write less code

“Someone complained that I took 3 days to write 3 lines of code. I told them they could have had it in 1 day but it would have been 20 lines.”

Nicole Sullivan.

Use Compass

Compass can make your life so much easier, and your work so much faster.

Have you ever created a sticky footer ?
or reset paddings and margins from Drupal core's stylesheets ?
with compass you just -
// Create a sticky footer @include sticky-footer(54px) // Reset padding, margin and border @include reset-box-model;

There is a lot more...

Use a layout system

Layout and Grid system can substantially shorten the time you spend on your layout, and later on browser compatibility issues.

With systems like Salsa, Susy, Zen Grids and others it becomes very simple to create your layout.

These 3 lines of code will give you a 3 column layout with full control on the position and order of the columns -
.e1 { @include grid(2, 8); } .e2 { @include grid(6 container, 0); } .e3 { @include grid(2, 6); }

How many lines of CSS (and time) does that worth ?

Don't write vendor prefixes


They take time to write.
They add bloat.
They need maintenance.

Many possible solutions:

Write better code

You should strive to produce the best results possible.

  • Use the latest technologies.
  • Follow latest best practices.
  • Use the right tools for the job.
  • Amaze, just for the sake of it.

But where do you find all this top-of-the-line know-how ?

Contribute

Contributing to Drupal core is probably the best way to learn new stuff, mingle with the pros, hear about the latest technologies and see what other people are working on, how they do it and why.

  • You write a patch - you get a review.
  • You write a review - you see other's work.
  • Contribute documentation - you learn from code.
  • Join the discussion - you learn from others.

There are many ways to contribute, you can start here or with the new Drupal Ladder project.

If you follow, they will come.

Don't search for info, Make it come to you.


Here are some of my resources:

Enjoy it

Or at least minimize the hassle


You shouldn't suffer doing what you do, and there are many ways you can improve your everyday experience.

Automate boring tasks


You should invest your time doing the interesting and fun parts of your job and automate, as much as possible, all the rest.

Some examples:

Make it your own

Spend some time on personalizing your work environment.


Stuff you should think of (linked are my choices):

  • Your hardware - a good machine is a life-changer.
  • Your OS - Some are better then others.
  • Your text editor and/or IDE - adjust to your needs.
  • Your browser - speed, features and extensions.
  • There is a lot more, god is in the details...

Setapp is a nice place to see what others are using.

Thanks