Removing dependencies

This commit is contained in:
Alex Hunt 2018-11-27 00:02:24 -08:00
parent 058a0adf51
commit a3fa83318e
5 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,5 @@
from flask import Flask
import json
from blueprints.joyce import joyce
from blueprints.api import api

View File

@ -1,9 +1,15 @@
from flask import Blueprint, render_template, abort, redirect
from jinja2 import TemplateNotFound
import json
import config
joyce = Blueprint('joyce', __name__)
manifest_path = config.MANIFEST_PATH
with joyce.open_resource(manifest_path, 'r') as stats_json:
assets = json.load(stats_json)
@joyce.route('/', defaults={'path': ''})
@joyce.route('/<path:path>')
def show_joyce(path):
return render_template('joyce.html')
return render_template('joyce.html', assets=assets)

View File

@ -5,6 +5,8 @@
"main": "app.js",
"scripts": {
"build": "rimraf static/js/ && webpack --config webpack.prod.js --mode=production",
"build_dev": "rimraf static/js/ && webpack --config webpack.prod.js --mode=development",
"watch": "rimraf static/js/ && webpack-cli --config webpack.dev.js --watch --mode=development",
"dev": "rimraf static/js/ && webpack-dev-server --hot --inline --config webpack.dev.js --mode=development",
"test": "python setup.py && jest --config jest.config.js --no-cache && python setup.py"
},
@ -49,6 +51,7 @@
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"webpack-manifest-plugin": "^2.0.4",
"webpack-merge": "^4.1.2"
}
}

View File

@ -3,11 +3,12 @@
<title>Joyce - Reader</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/static/image/icon.png">
<script>const assets = {{ assets|tojson }}</script>
</head>
<body>
<!-- Reader Layout -->
<div id="wrapper">
</div>
<!-- Scripts -->
<script src="/static/js/joyce.js"></script>
<script src="{{assets['joyce.js']}}"></script>
</body>

View File

@ -1,5 +1,6 @@
const webpack = require('webpack')
const path = require('path')
const ManifestPlugin = require('webpack-manifest-plugin')
const rootAssetPath = './src/'
@ -12,7 +13,7 @@ module.exports = {
},
output: {
publicPath: "/static/js/",
filename: '[name].js',
filename: '[name].[hash].js',
path: path.resolve(__dirname, 'static/js/')
},
module : {
@ -65,4 +66,7 @@ module.exports = {
}]
}
]},
plugins: [
new ManifestPlugin()
]
};