Last active
February 3, 2016 12:46
-
-
Save gabrielhpugliese/e49a8bd5f1ca65acc569 to your computer and use it in GitHub Desktop.
Python Muffin + Webpack Html Plugin
This file contains 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
# ... | |
BASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') # go one folder behind, but configure yours | |
JINJA2_TEMPLATE_FOLDERS = '../react-app/dist' | |
STATIC_FOLDERS = '../react-app/dist', | |
# ... |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= htmlWebpackPlugin.options.title %></title> | |
<link rel="stylesheet" href="{{app.cfg.STATIC_PREFIX}}/<%= htmlWebpackPlugin.files.css[0] %>"> | |
</head> | |
<body> | |
<div id="root"> | |
</div> | |
<script src="{{app.cfg.STATIC_PREFIX}}/<%= htmlWebpackPlugin.files.js[0] %>"></script> | |
</body> | |
</html> |
This file contains 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
// ... | |
plugins: [ | |
new ExtractTextPlugin('styles.[hash].css'), | |
new AssetsPlugin({ | |
path: path.join(__dirname, 'dist') | |
}), | |
new webpack.optimize.UglifyJsPlugin(), | |
new HtmlWebpackPlugin({ | |
title: 'My page', | |
template: path.join(__dirname, 'config/index-template.html'), | |
inject: false | |
}) | |
], | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment