Skip to content

Instantly share code, notes, and snippets.

@ZempTime
Created October 6, 2017 15:03
Show Gist options
  • Save ZempTime/492ad98ea3ce957de553010b8d58f097 to your computer and use it in GitHub Desktop.
Save ZempTime/492ad98ea3ce957de553010b8d58f097 to your computer and use it in GitHub Desktop.
Building out index.js files throughout app
require "pathname"
IGNORED_FILES = ['.DS_Store']
def recurse(directory)
current_dir = Pathname.new(directory)
populate_index(current_dir)
current_dir.children.each do |dir|
recurse(dir) if dir.directory?
end
end
def populate_index(directory)
# When opening a file for writing, i.e. using the "w" option, all previous contents of the file will be removed
# write to index.js in current dir
# get all children
# build require statements
end
#recurse('./app/angular')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment