Skip to content

Instantly share code, notes, and snippets.

@lydell
Created May 29, 2017 07:20
Show Gist options
  • Save lydell/4aed77086bc1c0a16193e73380908c5f to your computer and use it in GitHub Desktop.
Save lydell/4aed77086bc1c0a16193e73380908c5f to your computer and use it in GitHub Desktop.
Prettier SCSS
@font-face {
src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
}
// Catchall baseclass
.glyphicon {}
// Individual icons
.glyphicon-asterisk {}
_glyphicons.scss: prettier(input) !== prettier(prettier(input))
Index:
===================================================================
---
+++
@@ -6,10 +6,9 @@
));
}
-
-// Catchall baseclass
+ '#{$icon-font-pat
.glyphicon {
}
-// Individual icons
+// Catchall basecla
.glyphicon-asterisk {
}
@import url('foo');
$dir: 'fonts';
@font-face {}
font-face.scss: Error: unknown type: "media-url"
at genericPrintNoParens (/home/lydell/forks/prettier/src/printer.js:2796:13)
at genericPrint (/home/lydell/forks/prettier/src/printer.js:68:30)
at comments.printComments.p (/home/lydell/forks/prettier/src/printer.js:4743:12)
at Object.printComments (/home/lydell/forks/prettier/src/comments.js:929:19)
at printGenerically (/home/lydell/forks/prettier/src/printer.js:4741:21)
at FastPath.map (/home/lydell/forks/prettier/src/fast-path.js:123:19)
at genericPrintNoParens (/home/lydell/forks/prettier/src/printer.js:2612:30)
at genericPrint (/home/lydell/forks/prettier/src/printer.js:68:30)
at comments.printComments.p (/home/lydell/forks/prettier/src/printer.js:4743:12)
at Object.printComments (/home/lydell/forks/prettier/src/comments.js:929:19)
@mixin Hamburger($bar: 5px, $gap: 3px, $color: currentColor) {
background-image:
linear-gradient(
to bottom,
$color $bar,
transparent 0,
transparent ($bar + $gap),
$color 0,
$color ($bar * 2 + $gap),
transparent 0,
transparent ($bar * 2 + $gap * 2),
$color 0
);
}
hamburger.scss: ast(input) !== ast(prettier(input))
Index:
===================================================================
---
+++
@@ -95,49 +95,43 @@
},
{
- "groups": [
- {
- "value": "transparent",
- "type": "value-word",
- "isHex": false,
- "isColor": false
+ "value": "transparent",
+ "type": "value-func",
+ "unbalanced": 0,
+ "group": {
+ "open": {
+ "value": "(",
+ "type": "value-paren",
+ "parenType": ""
},
- {
- "open": {
- "value": "(",
- "type": "value-paren",
- "parenType": ""
- },
- "close": {
- "value": ")",
- "type": "value-paren",
- "parenType": ""
- },
- "groups": [
- {
- "groups": [
- {
- "value": "$bar",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- },
- {
- "value": "+",
- "type": "value-operator"
- },
- {
- "value": "$gap",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- }
- ],
- "type": "value-comma_group"
- }
- ],
- "type": "value-paren_group"
- }
- ],
- "type": "value-comma_group"
+ "close": {
+ "value": ")",
+ "type": "value-paren",
+ "parenType": ""
+ },
+ "groups": [
+ {
+ "groups": [
+ {
+ "value": "$bar",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ },
+ {
+ "value": "+",
+ "type": "value-operator"
+ },
+ {
+ "value": "$gap",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ }
+ ],
+ "type": "value-comma_group"
+ }
+ ],
+ "type": "value-paren_group"
+ }
},
{
@@ -158,58 +152,52 @@
},
{
- "groups": [
- {
- "value": "$color",
- "type": "value-word",
- "isHex": false,
- "isColor": false
+ "value": "$color",
+ "type": "value-func",
+ "unbalanced": 0,
+ "group": {
+ "open": {
+ "value": "(",
+ "type": "value-paren",
+ "parenType": ""
},
- {
- "open": {
- "value": "(",
- "type": "value-paren",
- "parenType": ""
- },
- "close": {
- "value": ")",
- "type": "value-paren",
- "parenType": ""
- },
- "groups": [
- {
- "groups": [
- {
- "value": "$bar",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- },
- {
- "value": "*",
- "type": "value-operator"
- },
- {
- "value": "2",
- "unit": "",
- "type": "value-number"
- },
- {
- "value": "+",
- "type": "value-operator"
- },
- {
- "value": "$gap",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- }
- ],
- "type": "value-comma_group"
- }
- ],
- "type": "value-paren_group"
- }
- ],
- "type": "value-comma_group"
+ "close": {
+ "value": ")",
+ "type": "value-paren",
+ "parenType": ""
+ },
+ "groups": [
+ {
+ "groups": [
+ {
+ "value": "$bar",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ },
+ {
+ "value": "*",
+ "type": "value-operator"
+ },
+ {
+ "value": "2",
+ "unit": "",
+ "type": "value-number"
+ },
+ {
+ "value": "+",
+ "type": "value-operator"
+ },
+ {
+ "value": "$gap",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ }
+ ],
+ "type": "value-comma_group"
+ }
+ ],
+ "type": "value-paren_group"
+ }
},
{
@@ -230,67 +218,61 @@
},
{
- "groups": [
- {
- "value": "transparent",
- "type": "value-word",
- "isHex": false,
- "isColor": false
+ "value": "transparent",
+ "type": "value-func",
+ "unbalanced": 0,
+ "group": {
+ "open": {
+ "value": "(",
+ "type": "value-paren",
+ "parenType": ""
},
- {
- "open": {
- "value": "(",
- "type": "value-paren",
- "parenType": ""
- },
- "close": {
- "value": ")",
- "type": "value-paren",
- "parenType": ""
- },
- "groups": [
- {
- "groups": [
- {
- "value": "$bar",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- },
- {
- "value": "*",
- "type": "value-operator"
- },
- {
- "value": "2",
- "unit": "",
- "type": "value-number"
- },
- {
- "value": "+",
- "type": "value-operator"
- },
- {
- "value": "$gap",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- },
- {
- "value": "*",
- "type": "value-operator"
- },
- {
- "value": "2",
- "unit": "",
- "type": "value-number"
- }
- ],
- "type": "value-comma_group"
- }
- ],
- "type": "value-paren_group"
- }
- ],
- "type": "value-comma_group"
+ "close": {
+ "value": ")",
+ "type": "value-paren",
+ "parenType": ""
+ },
+ "groups": [
+ {
+ "groups": [
+ {
+ "value": "$bar",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ },
+ {
+ "value": "*",
+ "type": "value-operator"
+ },
+ {
+ "value": "2",
+ "unit": "",
+ "type": "value-number"
+ },
+ {
+ "value": "+",
+ "type": "value-operator"
+ },
+ {
+ "value": "$gap",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ },
+ {
+ "value": "*",
+ "type": "value-operator"
+ },
+ {
+ "value": "2",
+ "unit": "",
+ "type": "value-number"
+ }
+ ],
+ "type": "value-comma_group"
+ }
+ ],
+ "type": "value-paren_group"
+ }
},
{
Index:
===================================================================
---
+++
@@ -1,14 +1,13 @@
@mixin Hamburger($bar: 5px, $gap: 3px, $color: currentColor) {
- background-image:
- linear-gradient(
- to bottom,
- $color $bar,
- transparent 0,
- transparent ($bar + $gap),
- $color 0,
- $color ($bar * 2 + $gap),
- transparent 0,
- transparent ($bar * 2 + $gap * 2),
- $color 0
- );
+ background-image: linear-gradient(
+ to bottom,
+ $color $bar,
+ transparent 0,
+ transparent($bar + $gap),
+ $color 0,
+ $color($bar * 2 + $gap),
+ transparent 0,
+ transparent($bar * 2 + $gap * 2),
+ $color 0
+ );
}
a {
box-shadow: inset 0 $size $size (-$size) black;
}
parens.scss: ast(input) !== ast(prettier(input))
Index:
===================================================================
---
+++
@@ -34,39 +34,38 @@
{
"value": "$size",
- "type": "value-word",
- "isHex": false,
- "isColor": false
+ "type": "value-func",
+ "unbalanced": 0,
+ "group": {
+ "open": {
+ "value": "(",
+ "type": "value-paren",
+ "parenType": ""
+ },
+ "close": {
+ "value": ")",
+ "type": "value-paren",
+ "parenType": ""
+ },
+ "groups": [
+ {
+ "groups": [
+ {
+ "value": "-",
+ "type": "value-operator"
+ },
+ {
+ "value": "$size",
+ "type": "value-word",
+ "isHex": false,
+ "isColor": false
+ }
+ ],
+ "type": "value-comma_group"
+ }
+ ],
+ "type": "value-paren_group"
+ }
},
{
- "open": {
- "value": "(",
- "type": "value-paren",
- "parenType": ""
- },
- "close": {
- "value": ")",
- "type": "value-paren",
- "parenType": ""
- },
- "groups": [
- {
- "groups": [
- {
- "value": "-",
- "type": "value-operator"
- },
- {
- "value": "$size",
- "type": "value-word",
- "isHex": false,
- "isColor": false
- }
- ],
- "type": "value-comma_group"
- }
- ],
- "type": "value-paren_group"
- },
- {
"value": "black",
"type": "value-word",
Index:
===================================================================
---
+++
@@ -1,3 +1,3 @@
a {
- box-shadow: inset 0 $size $size (-$size) black;
+ box-shadow: inset 0 $size $size(-$size) black;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment