Created
May 16, 2022 15:52
-
-
Save jhancock532/22aa79d7783d30add67fc5bacbd69c02 to your computer and use it in GitHub Desktop.
If you're importing scss files in your project using a glob, this snippet will rename and output the new imports. WIP draft
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
import glob | |
import os | |
scss_files = glob.glob('**/patterns/**/*.scss', recursive=True) | |
main_scss = "" | |
working_dir = os.getcwd() | |
for file in scss_files: | |
import_script = '@import '+ "'" + file | |
main_scss += import_script | |
main_scss += "\n" | |
head, tail = os.path.split(file) | |
old_file_path = file | |
new_file_path = os.path.dirname(file) + "/_" + tail | |
# os.rename(old_file_path, new_file_path) | |
f = open("main-imports.scss", "w") | |
f.write(main_scss) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment