All Projects → nicoespeon → sass-graph-viz

nicoespeon / sass-graph-viz

Licence: MIT license
Draw a visual graph of Sass dependencies

Programming Languages

typescript
32286 projects
CSS
56736 projects
Pug
443 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to sass-graph-viz

taiga-stats
Generate statistics from Taiga and produce burnup diagrams, CFDs, dependency graphs and more.
Stars: ✭ 40 (+90.48%)
Mutual labels:  dependency-graph
monopticon
Monitor ethernet traffic in real time with a 3D backend.
Stars: ✭ 57 (+171.43%)
Mutual labels:  dataviz
o-fish-web
Web application for the Officer's Fishery Information Sharing Hub (O-FISH). The web app allows agencies to gain insights from the aggregated information gathered during a routine vessel inspection (submitted via the web app).
Stars: ✭ 29 (+38.1%)
Mutual labels:  dataviz
leaflet-map-csv
Simple Leaflet map with points from local CSV file
Stars: ✭ 23 (+9.52%)
Mutual labels:  dataviz
vioplot
Development version of vioplot R package (CRAN maintainer)
Stars: ✭ 25 (+19.05%)
Mutual labels:  dataviz
planet-exporter
🚀 Determine server network dependencies along with required bandwidth
Stars: ✭ 17 (-19.05%)
Mutual labels:  dependency-graph
awesome-dataviz
📈 A curated list of awesome data visualization libraries and resources.
Stars: ✭ 3,153 (+14914.29%)
Mutual labels:  dataviz
scholia
Wikidata-based scholarly profiles
Stars: ✭ 166 (+690.48%)
Mutual labels:  dataviz
leafmap
A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
Stars: ✭ 1,299 (+6085.71%)
Mutual labels:  dataviz
nrwl-nx-action
A GitHub Action to wrap Nrwl Nx commands in your workflows.
Stars: ✭ 163 (+676.19%)
Mutual labels:  dependency-graph
gunfunded
Analyzing the gun lobby’s funding of Congress.
Stars: ✭ 32 (+52.38%)
Mutual labels:  dataviz
dash-lollapalooza-brasil-2018
🎟Using Plotly to visualize data from Lollapalooza
Stars: ✭ 23 (+9.52%)
Mutual labels:  dataviz
ee extra
A ninja python package that unifies the Google Earth Engine ecosystem.
Stars: ✭ 42 (+100%)
Mutual labels:  dataviz
metahelm
Install dependency graphs of Kubernetes Helm Charts
Stars: ✭ 70 (+233.33%)
Mutual labels:  dependency-graph
gosling.js
Grammar of Scalable Linked Interactive Nucleotide Graphics
Stars: ✭ 89 (+323.81%)
Mutual labels:  dataviz
datalith
Simple, batteries included, components to build beautiful data visualizations
Stars: ✭ 29 (+38.1%)
Mutual labels:  dataviz
javascript
Basic Primitives Diagrams for JavaScript - data visualization components library that implements organizational chart and multi-parent dependency diagrams, contains implementations of JavaScript Controls and PDF rendering plugins.
Stars: ✭ 46 (+119.05%)
Mutual labels:  dependency-graph
gephi-tutorials
Open and collaborative tutorials for Gephi
Stars: ✭ 97 (+361.9%)
Mutual labels:  dataviz
python dep generator
Genrates python dependency graph
Stars: ✭ 21 (+0%)
Mutual labels:  dependency-graph
IATI.cloud
The open-source IATI datastore for IATI data with RESTful web API providing XML, JSON, CSV output. It extracts and parses IATI XML files referenced in the IATI Registry and powered by Apache Solr.
Stars: ✭ 35 (+66.67%)
Mutual labels:  dataviz

Sass Graph Viz

Draw a visual graph of Sass dependencies.


version Build Status Changelog

sass-graph-viz-demo

I want to use it…

You need to install node.js.

As a command line tool

Install it with npm: npm install -g sass-graph-viz

$ sassgraphviz --help
Usage: sassgraphviz [options] <target>

Options:
  -e, --exclude-externals  Omit files that are not under given target
  -l, --load-paths         Add directories to the sass load path
  -s, --simple             Generate a simpler visualization (not recommended for complex graphs)
  -p, --port <port>        Port to use [3000]
  -d, --debug              Output details for debugging purposes
  -h, --help               Output usage information
  -v, --version            Print sass-graph-viz version

Examples:
  sassgraphviz assets/scss
  sassgraphviz .
  sassgraphviz main.scss
  sassgraphviz main.scss --load-paths path/to/sass-sources-1,path/to/sass-sources-2
  sassgraphviz main.scss -s -e -p 3001

You can also use the shorthand sgv instead of sassgraphviz (e.g. you can type sgv assets/scss).

As a node.js library…

Install it locally to your project: npm install --save-dev sass-graph-viz

Then import it in your code:

const sassGraphViz = require("sass-graph-viz");

To generate a visual graph

generateVisualGraph( target: string, options?: Options );

target can be a folder or a file.

options are optionals. Values are:

  • excludeExternals: boolean to omit files that are not under given target (default false)
  • loadPaths: string[] to add directories to the sass load path (default [process.cwd])
  • useSimpleViz: boolean to generate a simpler visualization (default false)
  • withDebugLogs: boolean to log details for debugging purposes (default false)
  • port: number to use a custom port (default 3000)

For instance:

  • sassGraphViz.generateVisualGraph('path/to/scss/') to render the default graph
  • sassGraphViz.generateVisualGraph('path/to/scss/', { useSimpleViz: true }) for the simpler visualization
  • sassGraphViz.generateVisualGraph('path/to/scss/', { port: 3001 }) to use port 3001

I want to modify the source code…

You need to install yarn.

First, clone the repository to get code locally: git clone [email protected]:nicoespeon/sass-graph-viz.git

Then, install dependencies: yarn install (or simply yarn)

Finally, if you do some changes, you need to rebuild the lib to use it: yarn build (or yarn build:watch for the watch mode).

And test that nothing has broken

Run tests with yarn test.

This project uses jest as a test runner.

And check the actual behavior of the code

Concrete scenarios are configured in examples/.

You can run one with yarn examples:<name-of-the-example>. For example:

  • yarn examples:basic-tree will run the examples/basic-tree/ scenario
  • yarn examples:simple-viz will run the examples/simple-viz/ scenario

You can run all examples with yarn examples.

I want to contribute

🤠 You're awesome!

Since this is the very beginning of the project, I didn't wrote a CONTRIBUTING.md yet. But you can go ahead, fork the repo, do your changes and create a Pull-Request.

I'm here to help. If you have any question, just ask with an issue.

If you don't feel like opening a PR, creating an issue to share some suggestions or report a bug is appreciated.

I want to know who made that

Made with ❤️ and 🦄 by Nicolas Carlo under the MIT license.

I have further questions…

Why some nodes are grey, green or red?

Sass-graph-viz does its best to help you analyze your codebase. Colors add semantics to nodes:

  • regular SCSS files are always legit, there is nothing we can tell, so they are grey
  • partials which are imported by another file feel valid, so they are green
  • orphan partials which are not imported are suspicious, so they are red
I've got LESS/CSS files in my codebase. Will it work?

Yes, it will.

It's not the main target of this library, but it can be handy if you need it. Plus, it was easy to enable, thanks to sass-graph's work.

What's the difference with sass-graph?

Indeed, there is this awesome lib called sass-graph which

Parses Sass files in a directory and exposes a graph of dependencies.

I found it when I was looking for a lib to generate a graph of sass dependencies for a messy project. Unfortunately, it was only able to output some sort of graph in my terminal, or a json structure. I wanted something visual.

So I decided to plug sass-graph with a rendering library: this is the core of sass-graph-viz.

The difference is that sass-graph-viz generates a visual graph of dependencies in your browser.

How is this built?

It started with sass-graph and a rendering library. For the latter, I went with viz.js first because the API was simple and the result looked great.

The core idea is:

  1. Expose a CLI command to get the path to the directory I want to parse
  2. Delegates to sass-graph the generation of dependencies graph
  3. Translate sass-graph's Graph into my Graph model
  4. Delegates to viz.js the rendering of the Graph in the browser

Graph of the core idea

graph TD
  CLI -- directory to parse --&gt; Generation["Generation (sass-graph)"]
  Generation -- Graph --&gt; Rendering["Rendering (viz.js)"]
  Rendering --&gt; Browser

Once I got the core idea, I can switch the infrastructure to use any concrete implementation I want, as long as it fulfills the expected interfaces.

If you're into Hexagonal Architecture, it may sounds like ports & adapters. It is, but I didn't made interfaces & the hexagon explicit yet (functions and types are simple enough).

For example, in v1, there are also:

  • A node.js API that is consumed in the examples (which are manual E2E tests of the visual result)
  • Another rendering solution using vis (because viz.js was not enough for real-life graphs)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].