Skip to content

Commit

Permalink
Add webassets and Flask-Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
aumayr committed Dec 14, 2015
1 parent c5b1e4e commit 838afa4
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*sass-cache*/
*.css.map
TODO.md
beancount_web/static/gen/
*.webassets-cache*/
4 changes: 4 additions & 0 deletions beancount_web/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
from datetime import date, datetime

from flask import Flask, render_template, url_for, request, redirect, abort, Markup
from flask.ext.assets import Environment, Bundle

app = Flask(__name__)
app.entry_filters = {}

assets = Environment()
assets.init_app(app)

@app.route('/account/<name>/')
def account_with_journal(name=None):
return account(account_name=name, with_journal=True)
Expand Down
27 changes: 16 additions & 11 deletions beancount_web/templates/_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,22 @@ <h1 id="site-name">{{ title }}</h1>
</div>
</div>

<script src="{{ url_for('static', filename='vendor/jquery-js/jquery-2.1.4.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/chartist-js/chartist.min.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/chartist-js/chartist-plugin-legend.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/chartist-js/chartist-plugin-tooltip.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/moment-js/moment.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/jquery-treemap-js/jquery-treemap.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/ace-js/ace.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/editor.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/charts.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/main.js') }}"></script>
{% assets
filters="rjsmin",
output="gen/packed.js",
"vendor/jquery-js/jquery-2.1.4.js",
"vendor/chartist-js/chartist.min.js",
"vendor/chartist-js/chartist-plugin-legend.js",
"vendor/chartist-js/chartist-plugin-tooltip.js",
"vendor/moment-js/moment.js",
"vendor/jquery-treemap-js/jquery-treemap.js",
"javascript/helpers.js",
"javascript/editor.js",
"javascript/charts.js",
"javascript/main.js" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}

{% block javascript %}{% endblock %}
</body>
</html>
6 changes: 5 additions & 1 deletion beancount_web/templates/context.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
{% set active_page = 'context' %}

{% block title %}Context{% endblock %}
{% block javascript %}<script src="{{ url_for('static', filename='javascript/editor.js') }}"></script>{% endblock %}

{% block javascript %}
<script src="{{ url_for('static', filename='vendor/ace-js/ace.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/editor.js') }}"></script>
{% endblock %}

{% block content %}
<h1>Context: <pre>{{ context.hash }}</pre></h1>
Expand Down
6 changes: 5 additions & 1 deletion beancount_web/templates/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
{% set active_page = 'source' %}

{% block title %}Source{% endblock %}
{% block javascript %}<script src="{{ url_for('static', filename='javascript/editor.js') }}"></script>{% endblock %}

{% block javascript %}
<script src="{{ url_for('static', filename='vendor/ace-js/ace.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/editor.js') }}"></script>
{% endblock %}

{% block content %}
<h1>Source</h1>
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
-e hg+https://bitbucket.org/blais/beancount#egg=beancount
Flask==0.10.1
Flask-Assets==0.11
itsdangerous==0.24
Jinja2==2.8
livereload==2.4.0
MarkupSafe==0.23
six==1.10.0
tornado==4.3
webassets==0.11.1
Werkzeug==0.11.2
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
install_requires=[
'beancount',
'Flask==0.10.1',
'Flask-Assets==0.11',
'livereload'
],
include_package_data=True,
Expand Down

0 comments on commit 838afa4

Please sign in to comment.