-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd246bc
commit e3586f5
Showing
18 changed files
with
247 additions
and
194 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Import the sass library | ||
const sass = require('sass'); | ||
const fs = require('fs'); | ||
|
||
// Define the SCSS content | ||
const scssContent = ` | ||
$utilities: ( | ||
"align": ( | ||
property: vertical-align, | ||
class: align, | ||
values: baseline top middle bottom text-bottom text-top, | ||
), | ||
"float": ( | ||
responsive: true, | ||
property: float, | ||
values: ( | ||
start: left, | ||
end: right, | ||
none: none, | ||
), | ||
) | ||
); | ||
`; | ||
|
||
function convertToJSON() { | ||
let scssInput | ||
let jsonOutput = {}; | ||
|
||
// Remove leading/trailing spaces and trailing comma | ||
scssInput = scssContent.trim().replace(/,\s*$/, ''); | ||
|
||
// Wrap the SCSS content in a JSON object | ||
const jsonString = `{ "utilities": { ${scssInput} } }`; | ||
|
||
try { | ||
jsonOutput = JSON.parse(jsonString); | ||
} catch (error) { | ||
jsonOutput = { error: "Invalid SCSS format." }; | ||
} | ||
|
||
// fs.writeFileSync('utilities.json', JSON.stringify(jsonOutput, null, 2);); | ||
|
||
return JSON.stringify(jsonOutput, null, 2); | ||
} | ||
|
||
// Write the JSON to a file | ||
const output = convertToJSON() | ||
|
||
fs.writeFileSync('utilities.json', output); | ||
|
||
console.log('SCSS to JSON conversion complete. JSON data saved to utilities.json.'); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
.filter { | ||
--#{$variable-prefix}blur: 0; | ||
--#{$variable-prefix}contrast: 0; | ||
--#{$variable-prefix}grayscale: 0; | ||
--#{$variable-prefix}hue-rotate: 0; | ||
--#{$variable-prefix}drop-shadow: 0; | ||
filter: blur(var(--#{$variable-prefix}blur)); | ||
--#{$prefix}blur: 0; | ||
--#{$prefix}contrast: 0; | ||
--#{$prefix}grayscale: 0; | ||
--#{$prefix}hue-rotate: 0; | ||
--#{$prefix}drop-shadow: 0; | ||
filter: blur(var(--#{$prefix}blur)); | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
.transform { | ||
--#{$prefix}translate-x: 0; | ||
--#{$prefix}translate-y: 0; | ||
--#{$prefix}translate-z: 0; | ||
--#{$prefix}perspective: 0; | ||
--#{$prefix}rotate: 0; | ||
--#{$prefix}rotate-x: 0; | ||
--#{$prefix}rotate-y: 0; | ||
--#{$prefix}skew-x: 0; | ||
--#{$prefix}skew-y: 0; | ||
--#{$prefix}scale-x: 1; | ||
--#{$prefix}scale-y: 1; | ||
transform: translateX(var(--#{$prefix}translate-x)) translateY(var(--#{$prefix}translate-y)) perspective(var(--#{$prefix}perspective)) rotate(var(--#{$prefix}rotate)) rotateX(var(--#{$prefix}rotate-x)) rotateY(var(--#{$prefix}rotate-y)) skewX(var(--#{$prefix}skew-x)) skewY(var(--#{$prefix}skew-y)) scaleX(var(--#{$prefix}scale-x)) scaleY(var(--#{$prefix}scale-y)); | ||
--#{$prefix}translate-x: 0; | ||
--#{$prefix}translate-y: 0; | ||
--#{$prefix}translate-z: 0; | ||
--#{$prefix}perspective: 0; | ||
--#{$prefix}rotate: 0; | ||
--#{$prefix}rotate-x: 0; | ||
--#{$prefix}rotate-y: 0; | ||
--#{$prefix}skew-x: 0; | ||
--#{$prefix}skew-y: 0; | ||
--#{$prefix}scale-x: 1; | ||
--#{$prefix}scale-y: 1; | ||
transform: translateX(var(--#{$prefix}translate-x)) translateY(var(--#{$prefix}translate-y)) perspective(var(--#{$prefix}perspective)) rotate(var(--#{$prefix}rotate)) rotateX(var(--#{$prefix}rotate-x)) rotateY(var(--#{$prefix}rotate-y)) skewX(var(--#{$prefix}skew-x)) skewY(var(--#{$prefix}skew-y)) scaleX(var(--#{$prefix}scale-x)) scaleY(var(--#{$prefix}scale-y)); | ||
} |
Oops, something went wrong.