Forked from draganmarjanovic/poylmer-element-import.py
Created
February 16, 2016 21:15
-
-
Save putraxor/4892feb0d1d4efd81a03 to your computer and use it in GitHub Desktop.
The script scans the current directory for polymer elements and then automatically generates a master import file - to save the user time.
This file contains hidden or 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
# README | |
# How to use: | |
# This script creates a file called 'element-import.html' which is filled with | |
# the polymer import statements automatically from the folders in the directory | |
# from which this script is run. | |
# Import OS to allow reading of directories | |
import os | |
# Gets list of folders within the current directory | |
list_of_files = next(os.walk('.'))[1] | |
# Create the file | |
output_file = open("element-import.html",'w') | |
# Add Polymer elements to main import file | |
for element in list_of_files: | |
if os.path.isfile(element+"/"+element+".html"): | |
output_file.write('<link rel="import" href="' + element + | |
'/' + element + '.html">\n') | |
else: | |
pass | |
output_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment