Skip to content

Instantly share code, notes, and snippets.

@symmetriq
Created December 4, 2014 20:07
Show Gist options
  • Save symmetriq/77caa1077edd322cba2d to your computer and use it in GitHub Desktop.
Save symmetriq/77caa1077edd322cba2d to your computer and use it in GitHub Desktop.
Convert LESS → SCSS

Convert LESS includes to SCSS.
Regex is PCRE. Adjust for your flavor as needed.
Now also handles includes in one-liners (e.g. a { .fancy-outline }).

Search
(\{ *|^ +)\.([\w_-]+(?:[(;]| *\}))

Replace
\1@include \2

Issues
  • For mixins that accept multiple comma-separated properties (such as .boxShadow), LESS requires an extra semicolon inside the parentheses (needed only when multiple properties are specified), which needs to be removed when moving to SCSS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment