mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-10-31 14:18:32 +00:00 
			
		
		
		
	Move pxToRem to functions partial
This commit is contained in:
		
							
								
								
									
										11
									
								
								assets/css/_sass/_functions.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								assets/css/_sass/_functions.scss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | @function pxToRem($pixels, $context: $browser-context) { | ||||||
|  |   @if (unitless($pixels)) { | ||||||
|  |     $pixels: $pixels * 1px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   @if (unitless($context)) { | ||||||
|  |     $context: $context * 1px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   @return $pixels / $context * 1rem; | ||||||
|  | } | ||||||
| @@ -2,23 +2,10 @@ | |||||||
| @import url('https://use.typekit.net/qlo3dpu.css'); | @import url('https://use.typekit.net/qlo3dpu.css'); | ||||||
|  |  | ||||||
| @import '~prism-themes/themes/prism-a11y-dark'; | @import '~prism-themes/themes/prism-a11y-dark'; | ||||||
|  | @import '_sass/functions'; | ||||||
| // FUNCTIONS |  | ||||||
|  |  | ||||||
| $browser-context: 16; | $browser-context: 16; | ||||||
|  |  | ||||||
| @function pxToRem($pixels, $context: $browser-context) { |  | ||||||
|   @if (unitless($pixels)) { |  | ||||||
|     $pixels: $pixels * 1px; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   @if (unitless($context)) { |  | ||||||
|     $context: $context * 1px; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   @return $pixels / $context * 1rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| pre[class*='language-'] { | pre[class*='language-'] { | ||||||
|   font-size: 1rem; |   font-size: 1rem; | ||||||
| } | } | ||||||
| @@ -96,7 +83,7 @@ $bold: 700; | |||||||
| body { | body { | ||||||
|   border-top: 1rem solid red; |   border-top: 1rem solid red; | ||||||
|   font-family: $sans-serif; |   font-family: $sans-serif; | ||||||
|   font-size: rem(20); |   font-size: pxToRem(20); | ||||||
|   padding: 2rem; |   padding: 2rem; | ||||||
|   margin: 0; |   margin: 0; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ned Zimmerman
					Ned Zimmerman