BADCamp 2012 -Beginner Best Practices

Preview:

Citation preview

Beginner Best Practices

Meghan Sweet (@meghsweet)4 November, 2012

BADCamp 2012

How do you learn Drupal?

Sometimes things are really easy.

Sometimes things are really hard.

Leveraging Contributed Modules

Standing on the Shoulders of Giants

- Assess the project page

- Read the README file

-Views, admin_menu, ctools, webform, wysiwyg, panels, context.

Where does Contributed code live?Put all contrib modules in ../sites/all/modules/OR../sites/all/modules/contrib

Put all custom modules in../sites/all/modules/custom

Put all themes in ../sites/all/themes

What do you need in your toolbox?HTML / CSS / Javascript / PHP

A good code editor

Firebug or Chrome Inspector

Drupal Community

You can leverage a lot of skills you already have.

Local Development EnvironmentLocal Environment

Drush

Version Control such as GIT

Basics of the command line

Development WorkflowDevelopment Environment- Dev > Test > Live

Where do your clients QA?

Use Version control to push to production- great for rolling back changes- great for multi-developer environments

Code vs Content- features module

Workflow to push to production

Exclude the files directory from the repo, files are like data.

The “Drupal Way”?

Site Development Plan

Typical Drupal Site

Gall's Law

A complex system that works is invariably found to have evolved from a simple system that worked...

Build features zoomed in, then pull back and

see how it all fits together.

Write a development plan

Forces you to think through your architecture and implications of decisions

Makes it a lot easier to build quickly- ex: grab all your modules at once, understand content and layout dependencies

Build, then theme

90% of the way there is often enough- Don’t be afraid to talk to your clients

Structure Content

Break up your content into the pieces you want control over.

Important in mobile theming- content first

Consider your admins and your visitors.

Good content is user-centeredAdopt the cognitive frameworks of your users- E R I N K I S S A N E

Feature DevelopmentIts essentially three steps, rinse and repeat.

1) Build a content type

2) Build a view

3) Build a layout

Slow Site?

Common Client-side Performance Pitfalls- Cache Settings

- Image Optimization

- Image File Subdirectories

- CSS Images

- Size of pages, libraries, CSS.

Theming!

Where everything can be overridden.

There is no "best" theme.

-@rupl

Where to startDevelop a theming strategy and find a theme to match

- ‘Starter’ themes- Base Themes- Responsive Theming- Click-to-Config

Control your layout through configurationPanels, Panelizer, Panopoly

Context

Omega

Display Suite

Advancing Theming

Its all about Overriding

Configuration -> CSS -> PHP

You can give back to the community.

Coding Standards-Don’t Hack Core! It may seems like a good idea now, but its not.

- Indent of 2 spaces

- No trailing white space

- CSS properties in alphabetical order

- Comment your code, you’ll thank yourself later.

- Participate in the issue queue and documentation.

Learn MoreBooks

Training

Documentation

Blogs

Videos

Meetups

Camps and Cons

IRC

Spirit of willingness, giving back and helping each other

Thank You!@meghsweet

@chapter_three

Recommended