58
Stop your SharePoint CSS becoming a di-SASS-ter today! #SPSOslo Stefan Bauer October 17 th , 2015 SharePoint Saturday Oslo 2015

SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Embed Size (px)

Citation preview

Page 1: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Stop your SharePoint CSS becoming a di-SASS-ter today!#SPSOslo

Stefan BauerOctober 17th, 2015

SharePoint SaturdayOslo 2015

Page 2: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SharePoint SaturdayOslo 2015

SharePoint SaturdayOslo 2015

Thanks to our

Sponsors

Page 3: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

n8d.at/blog@StfBauer

Information ArchitectVienna / Austria

Page 4: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Stop your SharePoint CSS becoming a di-SASS-ter today!

- I will explain what SASS is and how you can use it- How to use SASS to brand SharePoint without requiring lengthy deployments.- How to create simple Rich Text Editor Styles using mixins and includes.- How to apply a Grid layout and make it Responsive.- How to structure your branding correctly to make it more maintainable.- How CSS 4 fits into the picture and does it make SASS obsolete?

Page 5: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

BRANDING CHALLENGES

INTRODUCTION TO SASS

STRUCTURE YOUR BRANDING

Page 6: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

2013 / 2016

Office 365

Changed SharePoint Branding

2003 2007 / 20102013

Inject CSS 154 files

Search & Destroy

Golden AgeOf

Master Page

CSS or JS

Cloud or On-

Premises

Page 7: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Old workflow1. Create a farm solution2. Add Master Page3. Add CSS File4. Deploy5. Customized CSS File on Server6. Copy final CSS File to Farm

Solution7. Deploy Solution8. Repeat step 1 - 8

PROS:- Worked pretty well- Centralized Design Files- GhostingCONS:- Development on the Server- Farm solution- One single CSS File- Not cloud ready

Page 8: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Modularize CSS

Find and identify UI Elements faster

Divide complexity into smaller parts

Avoid developmentconflicts

Listing of a large computer program – Arnold Reinhold

Page 9: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Avoid Repeating Tasks

Reusable components

Better maintainable code

Page 10: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

On-premises In the cloud

?Source: http://my.n8d.at/1MVjnEV

Page 11: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

CSS Spaghetti Code

Page 12: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Håkon Wium LieFather of CSS

First CSS Proposal10th October 1994

Page 13: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Why is CSS the way it is?

CSS stops short of even more powerful features that programmers use in their programming languages: macros, variables, symbolic constants, conditionals, expressions over variables, etc. That is because these things give power-users a lot of rope, but less experienced users will unwittingly hang themselves; or, more likely, be so scared that they won’t even touch CSS. It’s a balance. And for CSS the balance is different than for some other things. – Bert Bos

Page 14: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

BRANDING CHALLENGES

INTRODUCTION TO SASS

STRUCTURE YOUR BRANDING

Page 15: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

What is SASS

CSS Pre Processor

A layer between style sheets and CSS

faster, more efficient, and easier to maintain.

MyBranding.css

Layout

TypoColors

Sass (short for Syntactically Awesome Stylesheets)

Page 16: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – Choose your style

SASS – SyntaxRUBY based syntaxFile extension: .sass

SCSS – SyntaxLike you writing native CSSFile extension: .scss

Page 17: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – for developer

Hack CSS

Benefit of a programming language

Calculates the headline font based on a dynamic ratio. Create a font shorthand definition by merging all the font properties like this.

CSS:font: italic small-caps bold 1em/140% Helvetica, sans-serif;

Page 18: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS - Variables

Page 19: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

W3C - CSS Variables – Specification

:root {

--main-color: #06c;

--accent-color: #006;

}

/* The rest of the CSS file */

#foo h1 {

color: var(--main-color);

}CSS – Variables

Post CSS – JavaScript

Page 20: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – Nesting < Parent

Page 21: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – Variables - Data types

• Numbers1.2, 13, 10px

• Strings with or without quotes"foo", 'bar', baz

• Colors blue, #04a3f9, rgba(255, 0, 0, 0.5)

• Booleanstrue / false

• Nullsnull – what else

• List of valuesseparated by spaces or commas 1.5em 1em 0 2emHelvetica, Arial, sans-serif

• Maps from one value to another (key1: value1, key2: value2))

Page 22: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS - @extend

Define element – reuse it with overrides

Page 23: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – Placeholder @extend

“%” acts like a new pseudo selector in addition to class and id css selector

Extend element templates without extending compiling the selector itself

Page 24: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS – Placeholder @extend

Page 25: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS - @mixin / @include

@mixin

• Re-use whole chunk of CSS• Acts like functions• Pass parameter• Default values for

parameter

@include

• Extend a selector with CSS

Page 26: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS - @mixin

CSS 3 transition mixin and browser fallback definitions

Page 27: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

SASS - @include

Page 28: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

@import – CSS vs SASS

CSS

• Each file will be requested separately

• Slow down UI• Don’t use it

SASS

• Compiles partials it into CSS file

• Supports CSS import• Allows to structure the

design

Page 29: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

@import – CSS vs SASSFilename: _yourvariables.scss

Use in SASS File:@import ‘yourvariables’@import ‘core/mixins’

Don’t forget the underscore!

Page 30: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
Page 31: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Why SASS?• CSS with superpower!• Clean structured code• Reusable components

• Consistency

• Many Extensions

Architecture your CSS: • OOCSS

Object oriented CSS

• SMACSSScalable and Modular Architecture for CSS

• BEMBlock Element Modifier

Blog post: Organizing CSS: OOCSS, SMACSS, and BEM

Page 33: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Yeoman

Runs on all major platforms (Windows, Mac, Linux)

Web related template engine

Page 34: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Yeoman – recommended templates

generator-webappbasic web application template

generator-angularangular web application template

Microsoft Office Project Generator - YO OFFICE!

Page 35: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Yeoman – generator-webapp

Webserver (Node.js)- Integrated SASS support- Auto-compile SASS to CSS- Auto reload web page- CSS can be integrated into SharePoint

on-premise or Office 365

Page 36: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Work Locally

Inject CSS and JS

No deployment downtime

Use JSOM / Rest API

Like an Add-in (App)

Full SASS Support

Works for Office 365 and on-premises

Page 37: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Work Locally

- Integrate Yeoman into SharePoint- Font reset in SharePoint- Rich Text Editor mixin

DEMO

Page 38: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Work Locally – more informationGetting started

How I develop in SharePoint and Office 365 now

How to use CSS and JavaScript files from Yeoman directly in SharePoint

Page 40: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

1. Define a Grid Layout

2. Define Media Breakpoints

3. Define how the content look and behave

Responsive Web Design

Page 41: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
Page 42: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Susy GridYour Layout - our math- Calculate grid- Easy to use- Built on SASS- Easy SharePoint integration

- Susy Grid / Tutorials

- SASS MediaqueriesProject on github

Page 43: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

BRANDING CHALLENGES

INTRODUCTION TO SASS

STRUCTURE YOUR BRANDING

Page 44: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

We’re not designing pages,we’re designing systems of components.

Stephen Hay

Page 45: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Responsive deliverables should look a lot like fully-functioning Twitter Bootstrap-style systems custom

tailored for your clients’ needs. – Dave Rupert

Page 46: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

MICRO BRANDINGJSLink, Display Templates and Script Embed Web Parts allow you to add

additional styles to SharePoint

Page 47: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Modern Design Style Guides

- HTML based- Dynamic Style Documentation- Allow to build new UI Components- Allows teams to work better together

Page 48: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Atomic Web Design – Brad Frost

Page 49: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
Page 50: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
Page 51: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

http://patternlab.io

Page 52: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Pattern Lab brought to SharePoint

DEMO

Page 53: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Recap – SASS• SASS helps you to write better CSS– Keep an eye on the source code– Well structured

• Supports DRY (Don’t repeat yourself) your development

Page 54: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Recap - Create your own style guide• Sketch in HTML first• Create reusable components• Document all design assets• Add things you need rather than use a framework

Page 56: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

Get stamps from all the sponsors, so make sure to visit them

Deposit the passport to enter the prize raffle

Good luck!

The SPSOslo Passport

Page 57: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

FREE BEER!Make sure to get your voucher

Network and have fun with your colleagues and mingle with our great speaker lineup.

SharePint sponsored by

Page 58: SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!

They help us improve for SharePoint Saturday 2016!

Remember to evaluate our sessions