Last active
December 27, 2015 07:39
-
-
Save jakob-e/7290310 to your computer and use it in GitHub Desktop.
Simple centralized path control v3.3 (using map)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//========================================================================= | |
// Paths SCSS 3.3 using map | |
// - Simple centralized path control | |
//========================================================================= | |
// Set default path - if no path is provided | |
// Enable paths - if false url(...) will work as normal | |
$paths-default:images !default; | |
$paths-enabled:true !default; | |
// Override CSS url(...) | |
@function url($src, $path:$paths-default){ | |
@if($paths-enabled and map-has-key($paths,$path)){ | |
@return unquote('url('+map-get($paths,$path)+ $src+')'); | |
} | |
@return unquote('url('+$src+')'); // Disabled, wrong or nulll | |
} | |
// Config example | |
$paths:( | |
img : '../img/' | |
,fonts : '../fonts/' | |
,url : '' | |
,base64gif : 'data:image/gif;base64,' | |
,whatever : 'http://www.whatever.com/' | |
,googlefonts : 'http://fonts.googleapis.com/css?family=' | |
); | |
$paths-default:img; | |
$paths-enabled:true; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment