GithubHelp home page GithubHelp logo

stefanovollono / specificity-graph Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 4.36 MB

Graphic representation of css specificity of your project

Home Page: http://stefanovollono.github.io/specificity-graph/index.html

HTML 12.18% JavaScript 43.50% Vue 25.34% TypeScript 13.47% SCSS 4.37% Shell 1.14%
css specificity graph

specificity-graph's Introduction

travis-ci languages version

The project

Is a really simple tool which allows to copy and paste your CSS and analyse the stylesheet specificity state. Any peaks of specificity can be analysed by hovering the node itself.

spec 1

Specificity

To calculate it is easy: ideally, is made of 4 values separated by a comma (0,0,0,0) and every type of selector (ID, class, etc) gives a unit to the referring channel. In theory, we would have:

  1. For every ID, add 0,1,0,0.
  2. For every class, pseudo-class and attribute selector add 0,0,1,0.
  3. For every element and pseudo-element, add 0,0,0,1.
  4. The specificity of a universal selector will amount to 0,0,0,0, which is not the same thing as saying that it doesn't have any.
  5. The specificity of a selector in line is equal to 1,0,0,0 (maximum value).
  6. Declarations with !important will trump whatever on every other declaration which doesn't use the same attribute.

spec 2

Avoid the peaks

The idea behind this comes from the need to keep under control the specificity level of our projects. A low level or, better, constant and linear level of the graphic, means having projects easy to maintain and scalable over time.

spec 3

The Specificity Graph Tool is fully based on open source projects:

Admin & Dashboard Templates inspiration

https://colorlib.com/wp/free-html5-admin-dashboard-templates/

Parsing file css:

A lightweight, battle tested, fast, css parser in JavaScript https://github.com/jotform/css.js

Specificity Calculator:

A JavaScript module for calculating and comparing the specificity of CSS selectors. The module is used on the Specificity Calculator website. https://github.com/keeganstreet/specificity

HTML5 Chart

Simple HTML5 Charts using the https://github.com/chartjs/Chart.js

specificity-graph's People

Contributors

dependabot[bot] avatar stefanovollono avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.