Theming practices for Drupal. Style Guides

28
Theming good practices www.wearepropeople.com Cebotari Kirill

Transcript of Theming practices for Drupal. Style Guides

Page 1: Theming practices for Drupal. Style Guides

Theming good practices

www.wearepropeople.com

Cebotari Kirill

Page 2: Theming practices for Drupal. Style Guides

Start with a sad news:

This presentation is not what you thinks it’s about.

www.wearepropeople.com

It’s just my opinion on how we can try to make theming practices good )

Page 3: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Content:1. Why ‘Theming’ ?2. What’s Best practices?3. Multi-class model4. Style Guides5. P.P.S.6. Round-up.

Page 4: Theming practices for Drupal. Style Guides

www.wearepropeople.com

1. Why ‘Theming’ ?http://drupal.org/project/Themes

And that’s all. It’s just the partconnected to theme files.

Page 5: Theming practices for Drupal. Style Guides

2. Best practice Best practice is used to describe the

process of developing and following a standard way of doing things that multiple organizations can use.

Page 6: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Theme coding standarts.

Making your theme semantically correcthttp://drupal.org/node/44072

Theme coding conventionshttp://drupal.org/node/1965

Theme Hook Suggestionshttp://drupal.org/node/1089656

Page 7: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Themes we use:

AdoptiveTheme Omega Zen

+ + ++ + ++ + ++ + ++ + ++ + ++ + +

HTML5ResponsiveMobile-first

SASSGrid

IE stylesRTL

Page 8: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Theming Tools

Page 9: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Server-side tools:

Modules

Conditional Stylesheets http://drupal.org/project/conditional_styles

Sassy* http://drupal.org/project/sassy

Block Class http://drupal.org/project/block_class

Menu Class http://drupal.org/project/menuclass

Display Suite http://drupal.org/project/ds Panels http://drupal.org/project/panels

Views http://drupal.org/project/views

Page 11: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Browser-side tools:

jQuery API Browserhttps://chrome.google.com/webstore/detail/abefhanahjellfbchdmkjdcchkogijhk?hl=en-US

PerfectPixelhttps://chrome.google.com/webstore/detail/dkaagdgjmgdmbnecmcefdhjekcoceebi?hl=en-US

MeasureIt!https://chrome.google.com/webstore/detail/aonjhmdcgbgikgjapjckfkefpphjpgma?hl=en-US

EyeDropper, DevTools Autosave, Build With Chrome etc.

Page 12: Theming practices for Drupal. Style Guides

Links again30 CSS Best Practices for Beginnershttp://net.tutsplus.com/tutorials/html-css-techniques/30-css-best-practices-for-beginners/

Smashing Magazine CSS principleshttp://www.smashingmagazine.com/mastering-css-principles-comprehensive-reference-guide/

HTML and CSS techniques and toolshttp://drupal.org/node/37156

Page 13: Theming practices for Drupal. Style Guides

www.wearepropeople.com

3. MultiClass model:

*Back to basics

Page 14: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Similar properties of elements combined into a simple class, like:

.grey-border {border: 1px #ddd solid;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;

}

Page 15: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Any classes you want:

.white-border

.grey-border

.grid3

.grid5

.light-gradient

.dark-gradient

.full-width

.clear-space

.purple

.orange

.no-space

.last-item

.slider

.bordered-image.padd15.padd30.no-margin.mar15.image-left.image-right

.simple-menu

.imaged-menu

.iconed

.btn

.full-table

.highlight-table.white-box.black-box.imaged-list.clear-fix

Page 16: Theming practices for Drupal. Style Guides

www.wearepropeople.com

So this block can only have:

purple-titlecircle-listgrey-gradientgrey-bordergrid5

Page 17: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Pros and Cons:

+ Can move parts from one project to another + Doesn’t create useless repeats in css + Can be used for style guide + Easy to add new styles + Part of theming turns into simple class adding

- Overriding styles for different pages - God damn classes everywhere! - Can be a real mess

Page 18: Theming practices for Drupal. Style Guides

www.wearepropeople.com

What does it lead to:

Style Guides

Time Saver

New (old) model of doing things

SASS friendly

Page 19: Theming practices for Drupal. Style Guides

Link, what else:Lego thinking (video)http://www.youtube.com/watch?v=F8mZGDFDceU

Theming resourceshttp://wiki.wearepropeople.md/node/70

CSS Frameworkshttp://coding.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/

Page 20: Theming practices for Drupal. Style Guides

www.wearepropeople.com

4. Style Guides:

A style guide is a set of standards for the writing and design of documents, either for general use or for a specific publication, organization or field.So theming style guide would be a set of rules and standards to be used all over the web application. Most important, it includes ready-made samples.

Page 21: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Who uses style guides:

Twitter Bootstrap http://twitter.github.com/bootstrap/

Page 22: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Links:Style Guide modulehttp://drupal.org/project/styleguide

Page 23: Theming practices for Drupal. Style Guides

www.wearepropeople.com

More Links:

Designing and Implementing Beautiful, Flexible Interfaceshttp://blip.tv/drupalcon/designing-and-implementing-beautiful-flexible-interfaces-6318672

Inventing on Principleshttps://vimeo.com/36579366

Page 24: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Style guides ftw:

• Change the thinking from ‘using a framework’ to ‘suing a style guide’

• Creating (new) standards for Front-end developers

• More client-friendly approach

Page 25: Theming practices for Drupal. Style Guides

www.wearepropeople.com

5. P.P.S

It doesn’t matter what tools you use,what practices, methods or style guides.

It’s the way you can define a pattern for your workand share your practices with community

We can define standards in theming and follow themonly when we have any.

Page 26: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Шаблонные сайты VS эксклюзивные сайтыhttp://habrahabr.ru/company/twins/blog/148340/

GitHub Style Guideshttps://github.com/styleguide/css

CSS 3 Selectorshttps://speakerdeck.com/u/rachelandrew/p/css3-selectors

Front-end style Guideshttp://24ways.org/2011/front-end-style-guides

Page 27: Theming practices for Drupal. Style Guides

www.wearepropeople.com

6. Round-up.

Page 28: Theming practices for Drupal. Style Guides

www.wearepropeople.com

Thanks!

Cebotari Chirill

twitter: @borzovmeweb: borzov.me