Created
October 14, 2020 02:20
-
-
Save deguchi/84004c47f331fc462b932dad51d4ece2 to your computer and use it in GitHub Desktop.
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
var fs = require('fs') | |
var sass = './src/sass/index.sass'; | |
fs.readFile(sass, 'utf8', function (err,data) { | |
if (err) { | |
return console.log(err); | |
} | |
// console.log(data) | |
var result = data.replace(/([\d+\.]+)rem/g, function(match) { | |
console.log(match) | |
var m = match.match(/[\d+\.]+/); | |
return 'rem(' + m + ')'; | |
}); | |
fs.writeFile(sass, result, 'utf8', function (err) { | |
if (err) return console.log(err); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment