You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on some tooling to do dependency analysis of my company's sass files.
In a nutshell I want to parse a sass file, extract the "imports" (eg @use, @include, etc) and build a dependency graph across our rather large codebase.
I was looking into the grass_compiler internals (correct me if I'm wrong) but it looks like most of the infra required to parse and traverse a sass file is pub(crate) - making it unusable externally.
GitHub seems to be having trouble with my comment, as the tab keeps crashing from OOM while I'm trying to reply.
As you mention, the AST internals necessary for doing traversal are not currently exposed. So far no one has asked for such functionality, and I haven't been able to decide on an API I like.
I was interested in the problem you described, and made a small attempt at it. I wrote some code using grass that traverses the AST of a large Sass library and ouputs a dotviz file of the dependency graph. You can find this sample here https://gist.github.com/connorskees/7af84cfe4b3157e0120dad06f33cd112. It's quite hacky and I really don't like the API, but it does function correctly.
I made public all of the necessary internals in 8b34d0e. I'm not sure when this will release to crates.io, but in the meantime you should be able to access this commit by cloning the repo locally and using a path dependency.
Please let me know if there's anything more you would need to implement what you have described.
The changes described in my previous comment have been released to crates.io as version 0.13.0. I will note that there have been some changes to the AST field names that will require updating in the code sample I posted.
If there is additional functionality you are interested in using grass for, please do open another issue.
I'm working on some tooling to do dependency analysis of my company's sass files.
In a nutshell I want to parse a sass file, extract the "imports" (eg
@use
,@include
, etc) and build a dependency graph across our rather large codebase.I was looking into the
grass_compiler
internals (correct me if I'm wrong) but it looks like most of the infra required to parse and traverse a sass file ispub(crate)
- making it unusable externally.I saw #77 mentions
Does this mean that you want to support this sort of usecase for 1.0?
The text was updated successfully, but these errors were encountered: