Skip to content

Instantly share code, notes, and snippets.

@gasolin
Last active December 30, 2015 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gasolin/7783453 to your computer and use it in GitHub Desktop.
Save gasolin/7783453 to your computer and use it in GitHub Desktop.
put this file in gaia main folder and run $ python relayout.py to replace layout breakpoint
# put this file in gaia main folder and run
# python relayout.py
# 768 -> 600
originWidth = 768
targetWidth = 600
# find and replace string
import os, fnmatch
def findReplace(directory, find, replace, filePattern):
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, filePattern):
filepath = os.path.join(path, filename)
with open(filepath) as f:
s = f.read()
s = s.replace(find, replace)
with open(filepath, "w") as f:
f.write(s)
findReplace("apps", str(originWidth), str(targetWidth), "*.css")
findReplace("shared/js/", str(originWidth-1), str(targetWidth-1), "screen_layout.js")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment