-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Output style JSON #253
Comments
Hi Jack, The main thing standing in your way would be that node-sass is a wrapper around libsass, and libsass doesn't support this kind of functionality (to my knowledge). This is likely to be something that you add into the package yourself, contributing it if you want. As for where you want to start... output styles are defined at https://github.com/andrew/node-sass/blob/master/sass.js#L22-L27 , and the sass render/renderSync exports are defined at https://github.com/andrew/node-sass/blob/master/sass.js#L68-L101 . You might want to add your own "json" entry to the accepted output styles, and something in render/renderSync to do your bidding based on the outputStyle. Note that you will not want to send the "json" outputStyle to libsass. |
Hmm okay, so you think I would need to contribute to libsass? I may end up just writing a simple regex pattern to extract variables instead. The idea is just to make variables available in JS. Ie: $breakpoint-mobile : 320px => window.sass['breakpoint-mobile'] Also thanks for getting back to me :) |
This is sounding more like something that you could/should do outside of node-sass. This may just be because I don't understand your use-case, but I don't know that many people would find a JSON output useful. What would happen when you pass outputStyle: "json" to the render/renderSync methods? Does it completely ignore libsass and do it's own thing? I guess the next best question is, what are you trying to achieve by doing this? Is there another, hopefully better way to do it? |
I think you're right. I'll pursue an independent track. Thanks for your help anyway - it was useful. Cheers. |
Update Node Sass to 3.0
Hi would it be difficult to include an output style that is JSON? The reason for this is I would like to be able to compile SASS with node-sass then iterate over it like an object in a Grunt JS plugin and use that information for some post-processing tasks.
One example would be getting SASS variables and making them available in JS. I'm happy to contribute if you could point me in the right direction.
Cheers
The text was updated successfully, but these errors were encountered: