Gathering detailed insights and metrics for sass-graph-viz
Gathering detailed insights and metrics for sass-graph-viz
Gathering detailed insights and metrics for sass-graph-viz
Gathering detailed insights and metrics for sass-graph-viz
npm install sass-graph-viz
Typescript
Module System
Node Version
NPM Version
Support loadPaths
Updated on Jun 29, 2021
Escape Windows paths
Updated on May 02, 2020
Handle LESS/CSS files too
Updated on Jul 19, 2019
Fix missing package.json file
Updated on Feb 08, 2019
Fix the release
Updated on Feb 08, 2019
Debug logs & CLI version
Updated on Dec 19, 2018
TypeScript (79.44%)
CSS (8.38%)
Pug (7.88%)
JavaScript (4.29%)
Total Downloads
5,925
Last Day
3
Last Week
11
Last Month
70
Last Year
686
MIT License
27 Stars
102 Commits
3 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Feb 22, 2025
Latest Version
2.4.0
Package Id
sass-graph-viz@2.4.0
Unpacked Size
1.49 MB
Size
371.85 kB
File Count
71
NPM Version
6.14.13
Node Version
14.17.0
Cumulative downloads
Total Downloads
Last Day
-50%
3
Compared to previous day
Last Week
-62.1%
11
Compared to previous week
Last Month
34.6%
70
Compared to previous month
Last Year
-37.8%
686
Compared to previous year
Draw a visual graph of Sass dependencies.
You need to install node.js.
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
).
Install it locally to your project: npm install --save-dev sass-graph-viz
Then import it in your code:
1const sassGraphViz = require("sass-graph-viz");
1generateVisualGraph( 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 graphsassGraphViz.generateVisualGraph('path/to/scss/', { useSimpleViz: true })
for the simpler visualizationsassGraphViz.generateVisualGraph('path/to/scss/', { port: 3001 })
to use port 3001
You need to install yarn.
First, clone the repository to get code locally: git clone git@github.com: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).
Run tests with yarn test
.
This project uses jest as a test runner.
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/
scenarioyarn examples:simple-viz
will run the examples/simple-viz/
scenarioYou can run all examples with yarn examples
.
:cowboy_hat_face: 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.
Made with :heart: and :unicorn: by Nicolas Carlo under the MIT license.
Sass-graph-viz does its best to help you analyze your codebase. Colors add semantics to nodes:
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.
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.
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:
Graph
modelGraph
in the browser1graph TD 2 CLI -- directory to parse --> Generation["Generation (sass-graph)"] 3 Generation -- Graph --> Rendering["Rendering (viz.js)"] 4 Rendering --> 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:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
61 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-04-28
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More