Skip to content

Instantly share code, notes, and snippets.

@gabrielhpugliese
Last active February 3, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielhpugliese/e49a8bd5f1ca65acc569 to your computer and use it in GitHub Desktop.
Save gabrielhpugliese/e49a8bd5f1ca65acc569 to your computer and use it in GitHub Desktop.
Python Muffin + Webpack Html Plugin
# ...
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',
# ...
<!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>
// ...
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