Skip to content

Instantly share code, notes, and snippets.

@esr360
Last active February 11, 2018 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esr360/0a572ae7ae248092d73009da450447d8 to your computer and use it in GitHub Desktop.
Save esr360/0a572ae7ae248092d73009da450447d8 to your computer and use it in GitHub Desktop.
/// Get parmater from config string
///
/// @author [@esr360](http://twitter.com/esr360)
/// @access public
///
/// @param {string} $string - the string from which to retrieve param
@function get-param($string) {
@if str-index($string, 'component("') == 1 {
$string: str-replace($string, 'component("', '');
$string: str-replace($string, '")', '');
}
@if str-index($string, 'modifier("') == 1 {
$string: str-replace($string, 'modifier("', '');
$string: str-replace($string, '")', '');
}
@if str-index($string, $component-glue) == 1 {
$string: strip-glue($string, $component-glue);
}
@if str-index($string, $modifier-glue) == 1 {
$string: strip-glue($string, $modifier-glue);
}
@return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment