Created
February 1, 2012 06:03
-
-
Save nakamura001/1715405 to your computer and use it in GitHub Desktop.
ベンダープレフィックスの追加
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
#! /usr/bin/env python | |
# coding: utf-8 | |
# -webkit- とベンダープレフィックスが付いている場合 | |
# 次の行に -moz- に差し替えたものを追加するプロブラム | |
# ※ @-webkit-〜 { } など、複数行に渡る場合は正しい構文に | |
# ならない事に注意 | |
import re | |
fname = "index.php" | |
fr = open(fname,"r") | |
fw = open(fname+"_","w") | |
p = re.compile('[^\-]*(\-webkit\-)') | |
for row in fr: | |
if p.match(row): | |
moz = re.sub('([^\-]*)(\-webkit\-)', r'\1', row) | |
fw.write(moz) | |
fw.write(row) | |
moz = re.sub('([^\-]*)(\-webkit\-)', r'\1-moz-', row) | |
fw.write(moz) | |
else: | |
fw.write(row) | |
fr.close() | |
fw.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment