Code Monkey home page Code Monkey logo

sass-scss-converter's People

Contributors

dependabot[bot] avatar enoooch avatar manuelsch avatar tomdo1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sass-scss-converter's Issues

Missing quotes on @import path

Capture

A valid import module in sass, which does not use quotes, is converted without the quotes being added (but which are required in scss).

Does not properly work with if-else

Input SCSS:

@mixin centered($horizontal: true, $vertical: true) {
  position: absolute;
  @if ($horizontal and $vertical) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  } @else if ($horizontal) {
    left: 50%;
    transform: translate(-50%, 0);
  } @else if ($vertical) {
    top: 50%;
    transform: translate(0, -50%);
  }
}

Output Sass:

@mixin centered($horizontal: true, $vertical: true)
  position: absolute
  @if ($horizontal and $vertical)
    top: 50%
    left: 50%
    transform: translate(-50%, -50%)

    left: 50%
    transform: translate(-50%, 0)

    top: 50%
    transform: translate(0, -50%)

The output lacks some else-if-s.

top-level includes are not converted

+dark
	.card
		background: white

is converted into

+ dark {
    .card {
		background: white
    }
}

but should be

@include dark {
    .card {
		background: white
    }
}

This only happens on the top level.

CLI?

Is there a way to run this locally via CLI? Would love to convert files in bulk.

Private placeholders are missing percent character

Affects SASS to SCSS

SASS Input:

%placeholder
  color: red
.my-thing
  @extend %placeholder

Expected SCSS Output:

%placeholder {
  color: red;
}
.my-thing {
  @extend %placeholder;
}

Actual SCSS Output:

placeholder {
  color: red;
}
.my-thing {
  @extend placeholder;
}

Affects SCSS to SASS

SCSS Input:

%placeholder {
  color: red;
}
.my-thing {
  @extend %placeholder;
}

Expected SASS Output:

%placeholder
  color: red
.my-thing
  @extend %placeholder

Actual SASS Output:

placeholder
  color: red
.my-thing
  @extend placeholder

Incorrect sass to scss conversion using nth-child selector

Not working ❌

The sass to scss conversion is giving the wrong output when using the selectors bellow:

  • nth-child(n + *any-number*)
  • nth-child(-n + *any-number*)

Working ✅

The following selectors are working properly

  • nth-child(odd)
  • nth-child(event)
  • nth-child(1)
  • nth-child(*any-number*)

Example

Input▶️

.cards
  &__wrapper
    +columns(3)
  &__wrapper
    padding-bottom: 50px
  &__wrapper:nth-child(3n+1)
    padding-right: 25px
  &__wrapper:nth-child(3n+2)
    padding-left: 12px
    padding-right: 12px
  &__wrapper:nth-child(3n+3)
    padding-left: 25px

Output ❌

.cards {
  &__wrapper {
    @include columns(3);
  }
  &__wrapper {
    padding-bottom: 50px;
  }
  false {
    padding-right: 25px;
  }
  false {
    padding-left: 12px;
    padding-right: 12px;
  }
  false {
    padding-left: 25px;
  }
}

Expected output ✅

.cards {
  &__wrapper {
    @include columns(3);
  }
  &__wrapper {
    padding-bottom: 50px;
  }
  &__wrapper:nth-child(3n+1) {
    padding-right: 25px;
  }
  &__wrapper:nth-child(3n+2) {
    padding-left: 12px;
    padding-right: 12px;
  }
  &__wrapper:nth-child(3n+3) {
    padding-left: 25px;
  }
}

Wrong indentation, code wont work

First of all, thanks for creating this!

I just wanted to test your tool and saw that the indentation of the output is wrong when converting to sass, see the attached screenshot.

--> &.hidden should apply to lightbox-wrapper but does to lightbox.

Best,
Silvan
Screenshot 2021-11-24 at 16 59 42

Parsing css variables cut --

sass src:

\:root
   --c1: #{$-c1}
   --c2: #{$-c2}
   --c3: #{$-c3}
   --c4: #{$-c4}
   --c5: #{$-c5}
   --c6: #{$-c6}

scss res:

\:root {
  c1: #{$-c1};
  c2: #{$-c2};
  c3: #{$-c3};
  c4: #{$-c4};
  c5: #{$-c5};
  c6: #{$-c6};
}

Script ignores interpolations

If I have interpolation in sass code ( like .class-#{ $somevar } ) script ignores it and writes simply .class-$somevar in output

malformed input...

Hello, Manuel!
Your application is fantastic and one of the most correct in converting from sass to scss!
Thank you very much for your work!

However, when you enter a line like this:
@import ../../../node_modules/normalize.css/normalize

instead of the expected string:
@import "../../../node_modules/normalize.css/normalize";

as a result, we get this:
malformed input...

approximately the same thing happens if somewhere inside there is a space an empty character (here, for example, it is after .2s):

$trs32: ease-in-out .32s
$trs2: ease-in-out .2s 
$basecolor: #25549
$activecolor: #1f477f

Thank you for your time!
Regards, Sergio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.