Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update sass2scss to latest version (v1.1.0) #2186

Merged
merged 1 commit into from
Sep 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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