Last active
August 29, 2015 14:13
-
-
Save Brookke/7c81b563b690f47dc586 to your computer and use it in GitHub Desktop.
Replaces colour to color in css files.
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 os | |
oldfilename = 'style.css' | |
newfilename = 'new.css' | |
replacements = {'colour':'color'} | |
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) | |
infile = open(os.path.join(__location__, oldfilename)) | |
outfile = open(os.path.join(__location__, newfilename), 'w') | |
for line in infile: | |
for src, target in replacements.iteritems(): | |
line = line.replace(src, target) | |
outfile.write(line) | |
infile.close() | |
outfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment