Created
November 4, 2019 03:48
-
-
Save SanthoshRaju91/2b87c3aa29abc887e0a882c248731fda to your computer and use it in GitHub Desktop.
JSCodeShift transformer for deleting `.scss` import references in your React project, just in case if you changed your mind to use post-css or tailwind.css for your project. Just like me (sh** me)
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
export default function transformer(file, api) { | |
const j = api.jscodeshift; | |
const root = j(file.source); | |
const match = /([a-zA-Z0-9\s_\\.\-\(\):])+(.scss)$/; | |
root | |
.find(j.ImportDeclaration) | |
.filter(path => match.test(path.value.source.value)) | |
.forEach(path => { | |
j(path).remove(); | |
}); | |
return root.toSource(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment