Skip to content

Commit

Permalink
Merge pull request #2186 from mgreter/sass2scss-1.1.0
Browse files Browse the repository at this point in the history
Update sass2scss to latest version (v1.1.0)
  • Loading branch information
mgreter authored Sep 24, 2016
2 parents f99628d + 09f98a1 commit 58420a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/sass2scss.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#ifndef SASS2SCSS_VERSION
// Hardcode once the file is copied from
// https://github.com/mgreter/sass2scss
#define SASS2SCSS_VERSION "1.0.6"
#define SASS2SCSS_VERSION "1.1.0"
#endif

// add namespace for c++
Expand Down
17 changes: 14 additions & 3 deletions src/sass2scss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ namespace Sass
}
}

// check if we have a BEM property (one colon and no selector)
if (sass.substr(pos_left, 1) == ":" && converter.selector == true) {
size_t pos_wspace = sass.find_first_of(SASS2SCSS_FIND_WHITESPACE, pos_left);
sass = indent + sass.substr(pos_left + 1, pos_wspace) + ":";
}

}

// terminate some statements immediately
Expand All @@ -584,10 +590,15 @@ namespace Sass
sass.substr(pos_left, 8) == "@charset"
) { sass = indent + sass.substr(pos_left); }
// replace some specific sass shorthand directives (if not fallowed by a white space character)
else if (sass.substr(pos_left, 1) == "=" && sass.find_first_of(SASS2SCSS_FIND_WHITESPACE, pos_left) != pos_left + 1)
else if (sass.substr(pos_left, 1) == "=")
{ sass = indent + "@mixin " + sass.substr(pos_left + 1); }
else if (sass.substr(pos_left, 1) == "+" && sass.find_first_of(SASS2SCSS_FIND_WHITESPACE, pos_left) != pos_left + 1)
{ sass = indent + "@include " + sass.substr(pos_left + 1); }
else if (sass.substr(pos_left, 1) == "+")
{
// must be followed by a mixin call (no whitespace afterwards or at ending directly)
if (sass[pos_left+1] != 0 && sass[pos_left+1] != ' ' && sass[pos_left+1] != '\t') {
sass = indent + "@include " + sass.substr(pos_left + 1);
}
}

// add quotes for import if needed
else if (sass.substr(pos_left, 7) == "@import")
Expand Down

0 comments on commit 58420a9

Please # to comment.