KittyGiraudel / ama

Ask me anything!
43 stars 4 forks source link

How do you deal with libraries written in sass indent when your code is all scss? #33

Closed dkebler closed 9 years ago

dkebler commented 9 years ago

Unless I am unaware there is no way to combine scss and sass indent in the same compile. In other words have an @import in my scss that imports a sass indent file and expect libsass to know the difference. There is only a switch for this so it's one or the other but not both at the same time.

There are several potentially good sass repos I might want to use but the authors are using indent sass instead of scss.

I know ruby sass has a command sass-convert but I'm trying to avoid ruby these days. My searching has not reviled a ruby free alternative, preferably something in C to compliment libsass, or better yet an npm node module that I can use in a gulp pipe to do on the fly conversion before compiling.

In general what is your take on this this "mess" of having two "styles" of "style" as it were.

I mean if you see a potentially good repo written in indent style do you just pass it by or do you have a slick way of dealing with it beyond just manually converting every time the author updates his repo?

KittyGiraudel commented 9 years ago

Hey.

At SassDoc, we needed a way to convert .sass to .scss from Node, so @pascalduez wrote some Node bindings for the original sass_convert gem: https://github.com/SassDoc/sass-convert. Unfortunately, I do not know any other way to do that as I don't think there is any Sass to SCSS converter written purely in Node.

My advice would be to have a build step (Gulp or whatever) that converts the Sass vendor to SCSS before compiling Sass (which would import the SCSS version of the vendor).

What do you think?

pascalduez commented 9 years ago

There is a sass2scss which is part of LibSass. (C++) https://github.com/mgreter/sass2scss

There is also a sass2scss written in JS. https://github.com/ArnaudRinquin/sass2scss

I haven't tested them.

Unfortunately our sass-convert is tight to the ruby gem.

KittyGiraudel commented 9 years ago

I'd say the first one is rock solid.

dkebler commented 9 years ago

Well I have already thought about what you suggest. I just was was hoping that a node converter existed which would make piping easier and install for others easier (no need to have a ruby dependency in what is almost a pure node (gulp) solution I have going)

So, since I use already use gulp and bower and have already written code that can find all the sass/scss files in bower packages I can specifically concat .sass files and run it through the converter and dump in into a file whenever I run my gulp bower task (which installs bower packages, saves scss paths and writes corresponding @import in my _vendor.scss file). There it can wait for a libass compile like a bower scss library whenever I run my gulp sass task.

But, it's a bit more complicated than first glance because I'll have to recurse through each bower library's @imports in their "main" file to be sure and convert all its dependencies too. So not sure what is the best strategy? Recreate a libraries file/directory structure but all in scss or concat them all together into one big scss file for that library? But if one wants to be able to root around in their code the former seems better.

I'm surprised that no one has done this before (at least I can't find any code). This issue of mixed sass vs scss libraries (code) has been around for awhile no. I suppose given another year or two this will become a non-issue as everyone should listen to Hugo and do all their Sass in Scss :-).

On Wed, Aug 12, 2015 at 5:15 AM, Hugo Giraudel notifications@github.com wrote:

Hey.

At SassDoc, we needed a way to convert .sass to .scss from Node, so @pascalduez https://github.com/pascalduez wrote some Node bindings for the original sass_convert gem: https://github.com/SassDoc/sass-convert. Unfortunately, I do not know any other way to do that as I don't think there is any Sass to SCSS converter written purely in Node.

My advice would be to have a build step (Gulp or whatever) that converts the Sass vendor to SCSS before compiling Sass (which would import the SCSS version of the vendor).

What do you think?

— Reply to this email directly or view it on GitHub https://github.com/HugoGiraudel/ama/issues/33#issuecomment-130278355.

Cheers, Cuidate, TTFN http://www.youtube.com/watch?v=5Gu50vq5ux4 David

dkebler commented 9 years ago

Thx. I wasn't able to find these. The JS version is now 2 years old so don't know if it's still usable (should be??).

I'm asking the node-sass folks if their package supports the C sass2scss which is apparently part of libsass now according to the repo. If so that's a nice solution as one will not have to install a cli libsass to use it in gulp.

Either way these are better than the ruby solution if they work fine.

On Wed, Aug 12, 2015 at 7:52 AM, Pascal Duez notifications@github.com wrote:

There is a sass2scss wich is part of LibSass. (C++) https://github.com/mgreter/sass2scss

There is also a sass2scss written in JS. https://github.com/ArnaudRinquin/sass2scss

I haven't tested them.

Unfortunately our sass-convert is tight to the ruby gem.

— Reply to this email directly or view it on GitHub https://github.com/HugoGiraudel/ama/issues/33#issuecomment-130330667.

Cheers, Cuidate, TTFN http://www.youtube.com/watch?v=5Gu50vq5ux4 David