{"id":13596417,"url":"https://github.com/pocketjoso/specificity-graph","last_synced_at":"2025-04-13T04:59:32.939Z","repository":{"id":57367169,"uuid":"26367122","full_name":"pocketjoso/specificity-graph","owner":"pocketjoso","description":"Generate interactive Specificity Graphs for your CSS","archived":false,"fork":false,"pushed_at":"2016-04-16T07:22:03.000Z","size":530,"stargazers_count":701,"open_issues_count":3,"forks_count":35,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-13T04:59:25.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jonassebastianohlsson.com/specificity-graph/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pocketjoso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-08T16:49:50.000Z","updated_at":"2024-08-10T19:44:47.000Z","dependencies_parsed_at":"2022-08-23T20:10:15.443Z","dependency_job_id":null,"html_url":"https://github.com/pocketjoso/specificity-graph","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketjoso%2Fspecificity-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketjoso%2Fspecificity-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketjoso%2Fspecificity-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocketjoso%2Fspecificity-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pocketjoso","download_url":"https://codeload.github.com/pocketjoso/specificity-graph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665757,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:02:25.305Z","updated_at":"2025-04-13T04:59:32.867Z","avatar_url":"https://github.com/pocketjoso.png","language":"JavaScript","readme":"# Specificity Graph (for CSS)\n[![NPM version](https://badge.fury.io/js/specificity-graph.svg)](http://badge.fury.io/js/specificity-graph)\n[![Build Status](https://travis-ci.org/pocketjoso/specificity-graph.svg?branch=master)](https://travis-ci.org/pocketjoso/specificity-graph)\n\nIdea by [Harry Roberts](http://csswizardry.com/2014/10/the-specificity-graph/)\n\n![The generated graph](https://raw.githubusercontent.com/pocketjoso/specificity-graph/master/img/example-graph.png)\nGenerate an interactive line graph showing the specificity in your stylesheet. Uses [d3](https://github.com/mbostock/d3), [css-parser](https://github.com/reworkcss/css-parse), and [specificity](https://github.com/keeganstreet/specificity).\n\n## Installation\n`npm install specificity-graph`\n\n## Usage\n`specifity-graph` can be used in different ways:\n* [CLI](#cli)\n* [Node module](#node-module)\n* [Via JavaScript](#via-javascript)\n* [Online](http://jonassebastianohlsson.com/specificity-graph/)\n\n### CLI\n`specificity-graph \u003ccssFile\u003e [options]`\n\nCreates a directory containing\n* `json` file with specificity data for your CSS\n* `html` file with interactive specificity graph for CSS\n* necessary JS files to run graph\n\n#### Options\n| Flag             | Description\n| ---------------- | ------------- |\n| -o --output      | name for generated directory (default: `specificity-graph`) |\n| -b --browser     | auto launch browser to view generated chart                 |\n| -h --help        | Help                                                        |\n\n### Node module\n```\nvar specificityGraph = require('specificity-graph');\n\nspecificityGraph(directory, css, function(directory){\n  console.log('specificity-graph files created in ' + directory);\n});\n```\n\n### Via JavaScript\nFirst get the `specificityGraph` accessible in your code:\n\n#### Using Browserify (or similar)\nJust `require('specificity-graph')`.\n\n#### Standalone (no module loader)\nAdd `\u003cscript src=\"specificity-graph-standalone.js\"\u003e\u003c/script\u003e`,\nthis will expose `specificityGraph` as a global variable.\n\n#### Methods\n* `specificityGraph.create(css, options)`\n* `specificityGraph.createFromData(specificityData, options)`,\n* `specificityGraph.update(css)`\n\n##### Options\n| Name             | Description\n| ---------------- | ------------- |\n| css              | String with css to generate specificity graph for |\n| specificityData  | JSON object with css specificity data. [CLI](#CLI) write a JSON in this format, as does the `lib/lineChart`'s create function' |\n\n###### Create options\n| Create option name   | Description\n| -------------------- | ------------- |\n| svgSelector          | Selector for `svg` element to draw specificity graph inside. Defaults to `.js-graph`. |\n| width                | default `1000`. You should set a viewBox value on the SVG element to match `width` and `height`, f.e. `viewbox='0 0 1000 4000'`. |\n| height               | default `400` |\n| showTicks            | `Boolean`. Show scale and ticks. Default `false`. |\n| xProp                | (possible values: `'selectorIndex'`, `'line'`). What to base the x dimension, 'location in stylesheet' in graph on: index of selector in CSS, or line number for selector in CSS. Default `'selectorIndex'`. |\n| yProp                | default `'specificity'` |\n","funding_links":[],"categories":["JavaScript","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocketjoso%2Fspecificity-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpocketjoso%2Fspecificity-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocketjoso%2Fspecificity-graph/lists"}