manuelsch / sass-scss-converter Goto Github PK
View Code? Open in Web Editor NEWAn online Sass-to-SCSS converter (and vice versa)
License: MIT License
An online Sass-to-SCSS converter (and vice versa)
License: MIT License
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.
Is it appropriate to do this?
+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.
Is there a way to run this locally via CLI? Would love to convert files in bulk.
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;
}
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
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*)
The following selectors are working properly
nth-child(odd)
nth-child(event)
nth-child(1)
nth-child(*any-number*)
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;
}
}
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};
}
If I have interpolation in sass code ( like .class-#{ $somevar } ) script ignores it and writes simply .class-$somevar in output
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.