Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save putraxor/4892feb0d1d4efd81a03 to your computer and use it in GitHub Desktop.
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.
# 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