Skip to content

Instantly share code, notes, and snippets.

@SanthoshRaju91
Created November 4, 2019 03:48
Show Gist options
  • Save SanthoshRaju91/2b87c3aa29abc887e0a882c248731fda to your computer and use it in GitHub Desktop.
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)
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