Last active
December 27, 2015 07:29
-
-
Save jakob-e/7289166 to your computer and use it in GitHub Desktop.
Simple centralized path control v3.12
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 | |
// - 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){ | |
@for $p from 1 through length($paths){ | |
@if(nth(nth($paths,$p),1)==$path){ | |
@return unquote('url('+nth(nth($paths,$p),2)+$src+')'); | |
} | |
} | |
} | |
@return unquote('url('+$src+')'); // Disabled, wrong or nulll | |
} | |
// Config example | |
$paths:( | |
(images,'../img/') | |
,(fonts ,'../fonts/') | |
,(url, '') | |
,(base64gif, 'data:image/gif;base64,') | |
,(whatever, 'http://www.whatever.com/') | |
,(googlefonts,'http://fonts.googleapis.com/css?family=') | |
); | |
$paths-default:images; | |
$paths-enabled:true; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment