Skip to content

Commit

Permalink
Add wapper to layout js codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
hustlzp committed Mar 31, 2015
1 parent 50c10ca commit 01d232d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flask_boost/project/application/utils/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@ def build_js(app):
page_js_string = ""

# layout
layout_js_prefix = "(function(){"
layout_js_suffix = "})();"
for layout_path in layout:
with open(os.path.join(static_path, layout_path)) as js_file:
page_js_string += js_file.read()
page_js_string += layout_js_prefix + js_file.read() + layout_js_suffix

# page
blueprints = app.blueprints.keys()
page_js_prefix = "if(document.documentElement.id==='%s'){(function(){"
page_js_suffix = "})();}"

# page
page_root_path = os.path.join(static_path, page_root_path)
for subdir in _get_immediate_subdirectories(page_root_path):
if subdir in blueprints:
Expand Down

0 comments on commit 01d232d

Please sign in to comment.