❔ How can I import json file inside a sass file?
I have looked around in the web for various solutions and found it could be done easily in javascript with a node package called node-sass and sass-json-importer something like that. But none of that solution works according to my requirement.
What I am looking for is a nuget package which can help my life easier?
I came across this nuget package called LibSassHost it can compile sass files with imported json into css files but whenever I compile them via code it through exception regarding the wrong sass format.
There is another extension webcompiler in VS2022 can I use this to achieve the same but from my knowledge it doesn't allows json imported statements at the top.
Basically What I want to do is get some variables like hosturl etc from some json file and then be able to import that json file inside a sass file so I can use the urls in various classes? Does this makes any sense?
4 Replies
why do you need to use a sass?
Stack Overflow
import JSON to SCSS/SASS
I have a theme.json and a index.scss file which customises material design styles.
theme.json
{
"palette": {
"primary": {
"main": "#1A1A1A"...
I need so I can use variables and compile my sass file to generate css in one go and not have to change everywhere if the hosting url changes
I went through this but isn't this for node applications I need to implement it in MVC core
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.