Skip to content

Instantly share code, notes, and snippets.

@ekohl
Created September 17, 2018 15:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/usr/bin/python2
"""
Automatic provides generator for webpack bundles
"""
import json
import sys
paths = [path.rstrip() for path in sys.stdin.readlines()]
for path in paths:
if path.endswith('webpack/manifest.json'):
with open(path) as fh:
manifest = json.load(fh)
for name, content in manifest['assetsByChunkName'].items():
if isinstance(content, basestring):
print 'foreman-webpack({}) = {}'.format(name, content))
else:
for chunk in content:
print 'foreman-webpack({}) = {}'.format(name, chunk))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment