browser-hack-sass-mixins icon indicating copy to clipboard operation
browser-hack-sass-mixins copied to clipboard

Syntax error at only_safari

Open spacedog4 opened this issue 7 years ago • 8 comments

I'm getting this syntax error at the mixin only_safari http://prntscr.com/fpoepl

I am using Koala 2.2 to compile the code

/*--- Only Safari ≥ 6.1 ---*/
// Dark magic, Don't touch
@function sf_func1($selector, $property) {
	@return '@media screen and(min-color-index:0)and(-webkit-min-device-pixel-ratio:0){@media{'+& $selector+'{'+$property;
}
@function sf_func2($value) {
	@return $value+'}}}';
}
@mixin only_safari($selector, $map){
	@at-root{
		@each $property, $value in ($map) {
			#{sf_func1($selector, $property)}: #{sf_func2($value)};
		}
	}
}

this line:

#{sf_func1($selector, $property)}: #{sf_func2($value)};

spacedog4 avatar Jun 29 '17 17:06 spacedog4

I am getting the same issue, which is unfortunate because safari 6-ish is exactly what I am trying to fix in my project.

Currently using Gulp-sass updated to the latest version, but upon compile I am getting the issue above:

`Details: status: 1 file: C:/Users/kpratt2/Documents/edu.emory.framework/source/css/scss/abstracts/_hax.scss line: 240 column: 38 formatted: Error: Invalid CSS after "...lue in ($map) {": expected 1 selector or at-rule, was "#{sf_func1($selecto" on line 240 of source/css/scss/abstracts/_hax.scss

         @each $property, $value in ($map) {

-------------------------------------^

messageFormatted: source\css\scss\abstracts\_hax.scss

Error: Invalid CSS after "...lue in ($map) {": expected 1 selector or at-rule, was "#{sf_func1($selecto" on line 240 of source/css/scss/abstracts/_hax.scss

         @each $property, $value in ($map) {

-------------------------------------^

messageOriginal: Invalid CSS after "...lue in ($map) {": expected 1 selector or at-rule, was "#{sf_func1($selecto"
relativePath: source\css\scss\abstracts\_hax.scss
domainEmitter: [object Object]
domain: [object Object]
domainThrown: false

`

KaylaPratt avatar Jul 26 '17 12:07 KaylaPratt

@spacedog4 or @KaylaPratt How did you solve it? Having the same issue here.

joseallona avatar Jan 23 '18 21:01 joseallona

@spacedog4 , @joseallona or @KaylaPratt : any luck fixing this? I have the same Problem using "gulp-sass": "^3.1.0"

bjoern-dev avatar Mar 09 '18 10:03 bjoern-dev

Yeah i am having the same issue.

lglasgow avatar Apr 09 '18 18:04 lglasgow

Just in case anyone else is looking for this, I've had success with this one:

@media not all and (min-resolution:.001dpcm){
	@supports (-webkit-appearance:none) {
		// Safari only rules here.
	}
}

Keep in mind, that I do not know how well it works, as I have not tested it thoroughly. Only tested on MacOS Mojave with Safari 12.1, and Windows 10 with Google Chrome 76.0.3809.132 x64. Sorry for necroing, if anyone finds that annoying.

MaverickMartyn avatar Sep 12 '19 12:09 MaverickMartyn

Is there any update?

meoooh avatar Sep 09 '20 10:09 meoooh

Is there any update?

I'm fairly certain this project is dead. There has been zero code contributions for the past 3 or so years.

MaverickMartyn avatar Sep 26 '20 08:09 MaverickMartyn

Sorry everyone, I haven't used Sass for a long time and with today browsers, we barely need CSS hacks.
So, @MaverickMartyn is right, this project is dead. There is a pull request about safari issue tho. I can't test it but if anyone can confirm that it works, I can merge it.

saadeghi avatar Dec 16 '20 11:12 saadeghi