Remove Flask Assets

This commit’s parent introduces a Node-based way of managing front end assets.

Nothing else is needed in the app, specifically not Flask Assets. Flask itself
automatically routes requests for `domain.tld/static/*` to the files in
`app/static`.

This also removes all the Ruby stuff.
This commit is contained in:
Chris Hill-Scott
2015-12-15 11:56:37 +00:00
parent 5ebeec08ae
commit fd4c4107ac
6 changed files with 2 additions and 93 deletions

View File

@@ -1,2 +0,0 @@
source 'https://rubygems.org'
gem 'sass'

View File

@@ -1,13 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
sass (3.4.19)
PLATFORMS
ruby
DEPENDENCIES
sass
BUNDLED WITH
1.10.6

View File

@@ -1 +1 @@
web: python app.py runserver
web: python app.py runserver

2
app.py
View File

@@ -1,8 +1,6 @@
import os
from flask.ext import assets
from flask.ext.script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
from webassets.filter import get_filter
from app import create_app, db

View File

@@ -73,84 +73,11 @@ def init_app(app):
if key in os.environ:
app.config[key] = convert_to_boolean(os.environ[key])
init_asset_environment(app)
@app.context_processor
def inject_global_template_variables():
return {'asset_path': '/static/'}
def init_asset_environment(app):
env = assets.Environment(app)
# Tell flask-assets where to look for our sass files.
env.load_path = [
os.path.join(os.path.dirname(__file__), 'assets'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/stylesheets/govuk_frontend_toolkit'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/govuk_template'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/views'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/components'),
]
scss = get_filter('scss', as_output=True)
env.register(
'css_all',
assets.Bundle(
'main.scss',
filters='scss',
output='stylesheets/css_all.css'
)
)
env.register(
'css_govuk-template',
assets.Bundle(
'govuk_template/govuk-template.scss',
filters='scss',
output='stylesheets/govuk-template.css',
depends='*.scss'
)
)
env.register(
'css_govuk-template-ie6',
assets.Bundle(
'govuk_template/govuk-template-ie6.scss',
filters='scss',
output='stylesheets/govuk-template-ie6.css'
)
)
env.register(
'css_govuk-template-ie7',
assets.Bundle(
'govuk_template/govuk-template-ie7.scss',
filters='scss',
output='stylesheets/govuk-template-ie7.css'
)
)
env.register(
'css_govuk-template-ie8',
assets.Bundle(
'govuk_template/govuk-template-ie8.scss',
filters='scss',
output='stylesheets/govuk-template-ie8.css'
)
)
env.register(
'css_govuk-template-print',
assets.Bundle(
'govuk_template/govuk-template-print.scss',
filters='scss',
output='stylesheets/govuk-template-print.css'
)
)
def convert_to_boolean(value):
if isinstance(value, string_types):
if value.lower() in ['t', 'true', 'on', 'yes', '1']:

View File

@@ -1,6 +1,5 @@
Flask==0.10.1
Flask-Script==2.0.5
Flask-Assets==0.11
Flask-Migrate==1.3.1
Flask-SQLAlchemy==2.0
psycopg2==2.6.1
@@ -10,4 +9,4 @@ Flask-WTF==0.11
Flask-Login==0.2.11
Flask-Bcrypt==0.6.2
git+https://github.com/alphagov/notify-api-client.git@0.1.4#egg=notify-api-client==0.1.4
git+https://github.com/alphagov/notify-api-client.git@0.1.4#egg=notify-api-client==0.1.4