• This repository has been archived on 05/Dec/2022
  • Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    CSS
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The official style guide and framework for all Zalando Brand Solutions products

Build Status Dependency Status devDependency Status Gitter

The Dress Code

The Dress Code is a style library / style guide which is designed for maintainability and modularity.

Used by Zalando Brand Solutions department to solve the challenge of consistency between multiple apps.

We open sourced the project because we think it's a good example of how collaboration between UX Designers and Developers is enhancing consistency and user experience with the help of technology.

If you want to know more about the history and the process behind this project you might be interested in this article.

Quick links

Main Features

  • Follows BEM β€” Block Element Modifier methodology

  • Follows Atomic Design principles

  • Built with Sass, that means:

    • Modular - import just what you need
    • Reusable - apply styles on your own components by using Sass mixins
    • Customizable - "tweak" the look and feel by overriding variables or extending existing classes
  • Updated interactive demo site

Status

The Dress Code core is actively maintained by two teams within Zalando. The core components are in a stable state, should you however encounter any bugs, feel free to create an issue and/or a pull request

We are always looking forward to open source community feedback and contributions especially about:

  • browser/device compatibility bugs
  • enhancements

We usually mark the issues where we would like to see community contributions with a "help wanted" label.

Feel free to open issues and/or fork the project to contribute (see Development & Contrbuting section).

Browser Compatibility

Chrome 48+, Firefox 44+, Safari 8+, IE 10+.

Semantic Versioning

The Dress Code follows semantic version standards.

However, to be clear, we must describe which part of the exposed API we consider public and which one we consider private. When using common programming languages such as Java, PHP or Javascript this concept is usually defined by the language semantics (eg. private or protected keywords) or by some naming conventions (eg. having an _underscore before the name of the function or the variable).

The Dress Code considers part of the PUBLIC API just:

  • all css class names and selectors exposed by the library
  • all mixins representing a corresponding css selector (eg. @mixin dc-btn)
  • all others documented Sass variables/placeholder/mixins (we consider a Sass variable/mixin/placeholder documented just if it's mentioned in the Sass reference published on the documentation website).

Everything else is considered PRIVATE, that means you can still use it but at your own "risk".

Getting Started

Requirements

  • modernizer ~2.8.2 included in the <head> of your web page.

Installation

npm install dress-code --save

⚠️ NOTE: We recently dropped bower support (from version 2.1.0). Keep calm and do npm.

Usage

Include this in your <head>:

<link href="node_modules/dress-code/dist/css/dress-code.min.css" rel="stylesheet">

How to use Dress Code with Sass

If you are already using Sass in your project, you can import the Dress Code directly.

@import "node_modules/dress-code/dist/sass/dress-code";
@include dc-everything; // output dc-* selectors

When using Sass, customization can be achieved by:

  • Updating variable values, you can take a look at src/styles/core/_variables.scss to see all available variables and their default values.

  • Apply mixins to your elements, nearly every css selector has a corresponding mixin.

NOTE: Given that, for example, the compiled css file will be served at /styles/main.css, by default Fonts and Images will be served from /fonts and /img path.

To adjust this behavior according to your setup, update the $dc-font-path and $dc-image-path variable values.

Compass notes

For those using Compass, you can add this to your config.rb file:

add_import_path "node_modules"

Then you can import the dress-code like so:

@import "dress-code/dist/sass/dress-code";

Development & Contributing

Developers interested in contributing should read the following:

Install

Requirements

  • node.js. Make sure your have v7.0.0 or higher installed before proceeding.

Install

$ git clone https://github.com/zalando/dress-code.git && cd dress-code
$ npm install

Start the local development environment:

$ npm start

To open a new browser window or to pass a value to browserSync open option:

npm start -- --open

Visual regression tests

Initialization:

In order to avoid unexpected visual changes we have setup an automated visual regression testing system based on PhantomCSS, which generates and compares screenshots taken on all the components of Dress Code with their previous state, based on the demo page templates, notifying the developer about all the discrepancies found so they can be reviewed and ajusted properly before opening a pull request.

This system can be initialized in three different modes by using any of the following npm scripts:

$ npm run test

$ npm run test:minified

$ npm run test:rebase

By default, with the former npm script, the system will run all the test cases using an unminified version of the artifact, which will be built to incorporate the current changes.

The second option is intended for releases, which will run the tests by using the minified version of the artifact bundled to be distributed with the new version about to be released.

Last, the latter option regenerates the baseline used for further image comparisons, which represents the current validated state of the Dress Code components. By using this option, the developer states that the changes notified by the diff are done purposely and will become the new look of such affected component from that moment on.

Test cases:

Test cases are described in tests/globals.js by specifying the name of the component (atom or molecule) to be tested and an array containing the names of the template files related to that component in the demo.

On execution, descriptive messages will be shown in console informing about each test suite's results.

Screenshots:

The system will generate a screenshot per each file and store them into several directories, grouped by component name, under either tests/screenshots/baseline or tests/screenshots/results depending on the execution mode chosen.

Since storing that many generated binary files in Git is not recommended as it may lead to problems in repositories drastically growing in size, we took advantage of GitHub's open source library Git Large File System (LFS) which replaces the content of a binary file by text pointers to the actual content location where they are stored in the server.

Please make sure to follow the steps described at their website to install and configure it properly.

Adding new icons

Make sure your icons have a size of 512x512px and flatten and simplify the paths before you export them. Place each icon as SVG file into src/icons/. Add each new icon in the demo by adding it in docs/demo/materials/03-atoms/icons/01-icons.html such as

    <div class="sg-icon dc-column">
        <i class="dc-icon dc-icon--[ICON-FILENAME]"></i><span>[ICON-FILENAME]</span>
    </div>

and replace [ICON-FILENAME] with the actual icon filename. Run npm start -- --open to see the result.

Development Environment Features

  • Sass compilation (using node-sass)
  • Sass linting (using scss-lint)
  • CSS Auto-prefixing / Optimization
  • Image optimization
  • Icon Font generator
  • Demo/docs site generator
  • Live preview sever (using BrowserSync)
  • CHANGELOG generator
  • Visual regression testing

Build & Deploy

Build distribution:

$ npm run build

The distribution build artifacts output to the dist directory.

Build demo:

$ npm run demo:build

Fabricator builds both a static documentation site and optimized CSS and JS toolkit files.

The demo build artifacts output to the .tmp/.demo directory. This can be deployed to any static hosting environment - no language runtime or database is required.

Deploy demo:

$ npm run demo:deploy

Publish the demo as github-pages website @ https://zalando.github.io/dress-code

License

Copyright 2016 Zalando SE

The Dress Code is released under the MIT license. See LICENSE for details.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

patroni

A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes
Python
6,267
star
2

postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
Go
3,686
star
3

skipper

An HTTP router and reverse proxy for service composition, including use cases like Kubernetes Ingress
Go
3,088
star
4

restful-api-guidelines

A model set of guidelines for RESTful APIs and Events, created by Zalando
CSS
2,605
star
5

zalenium

A flexible and scalable container based Selenium Grid with video recording, live preview, basic auth & dashboard.
Java
2,385
star
6

SwiftMonkey

A framework for doing randomised UI testing of iOS apps
Swift
1,947
star
7

logbook

An extensible Java library for HTTP request and response logging
Java
1,788
star
8

tailor

A streaming layout service for front-end microservices
JavaScript
1,728
star
9

tech-radar

Visualizing our technology choices
1,581
star
10

spilo

Highly available elephant herd: HA PostgreSQL cluster using Docker
Python
1,225
star
11

intellij-swagger

A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA
Java
1,172
star
12

problem-spring-web

A library for handling Problems in Spring Web MVC
Java
1,031
star
13

nakadi

A distributed event bus that implements a RESTful API abstraction on top of Kafka-like queues
Java
928
star
14

zally

A minimalistic, simple-to-use API linter
Kotlin
903
star
15

problem

A Java library that implements application/problem+json
Java
869
star
16

zalando-howto-open-source

Open Source guidance from Zalando, Europe's largest online fashion platform
799
star
17

go-keyring

Cross-platform keyring interface for Go
Go
689
star
18

gin-oauth2

Middleware for Gin Framework users who also want to use OAuth2
Go
579
star
19

zappr

An agent that enforces guidelines for your GitHub repositories
JavaScript
542
star
20

pg_view

Get a detailed, real-time view of your PostgreSQL database and system metrics
Python
494
star
21

engineering-principles

Our guidelines for building new applications and managing legacy systems
376
star
22

gulp-check-unused-css

A build tool for checking your HTML templates for unused CSS classes
CSS
359
star
23

zmon

Real-time monitoring of critical metrics & KPIs via elegant dashboards, Grafana3 visualizations & more
Shell
355
star
24

expan

Open-source Python library for statistical analysis of randomised control trials (A/B tests)
Python
325
star
25

PGObserver

A battle-tested, flexible & comprehensive monitoring solution for your PostgreSQL databases
Python
316
star
26

riptide

Client-side response routing for Spring
Java
292
star
27

jackson-datatype-money

Extension module to properly support datatypes of javax.money
Java
240
star
28

grafter

Grafter is a library to configure and wire Scala applications
Scala
240
star
29

opentracing-toolbox

Best-of-breed OpenTracing utilities, instrumentations and extensions
Java
180
star
30

elm-street-404

A fun WebGL game built with Elm
Elm
176
star
31

tokens

Java library for conveniently verifying and storing OAuth 2.0 service access tokens
Java
169
star
32

innkeeper

Simple route management API for Skipper
Scala
166
star
33

public-presentations

List of public talks by Zalando Tech: meetup presentations, recorded conference talks, slides
165
star
34

python-nsenter

Enter kernel namespaces from Python
Python
139
star
35

faux-pas

A library that simplifies error handling for Functional Programming in Java
Java
132
star
36

beard

A lightweight, logicless templating engine, written in Scala and inspired by Mustache
Scala
121
star
37

friboo

Utility library for writing microservices in Clojure, with support for Swagger and OAuth
Clojure
117
star
38

spring-cloud-config-aws-kms

Spring Cloud Config add-on that provides encryption via AWS KMS
Java
99
star
39

zalando.github.io

Open Source Documentation and guidelines for Zalando developers
HTML
86
star
40

failsafe-actuator

Endpoint library for the failsafe framework
Java
52
star
41

package-build

A toolset for building system packages using Docker and fpm-cookery
Ruby
35
star
42

ghe-backup

Github Enterprise backup at ZalandoTech (Kubernetes, AWS, Docker)
Shell
30
star
43

rds-health

discover anomalies, performance issues and optimization within AWS RDS
Go
26
star
44

backstage-plugin-api-linter

API Linter is a quality assurance tool that checks the compliance of API's specifications to Zalando's API rules.
TypeScript
12
star
45

.github

Standard github health files
1
star