diff options
author | raylu <raylu@gridium.com> | 2013-10-19 18:30:23 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-19 18:30:23 -0700 |
commit | 4fcc479ed7656f675491c3563eff6c966118a30e (patch) | |
tree | 4bea4baa7539af7ce612771c4f95cdc69667d23d /web | |
parent | c6cb565f1216054fd386e0e5cd107cf7989a80e6 (diff) | |
download | ykill-4fcc479ed7656f675491c3563eff6c966118a30e.tar.xz |
switch to cleancss
Diffstat (limited to 'web')
-rwxr-xr-x | web/server.py | 57 | ||||
-rw-r--r-- | web/static/css/base.ccss (renamed from web/static/css/base.less) | 20 |
2 files changed, 7 insertions, 70 deletions
diff --git a/web/server.py b/web/server.py deleted file mode 100755 index 01475c1..0000000 --- a/web/server.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -import json -from lesscss import lessc -import tornado.gen -import tornado.httpclient -import tornado.ioloop -import tornado.web -import operator -import os - -import config - -class BaseHandler(tornado.web.RequestHandler): - def render(self, *args, **kwargs): - kwargs['host'] = config.web.host - return super(BaseHandler, self).render(*args, **kwargs) - - def render_string(self, *args, **kwargs): - s = super(BaseHandler, self).render_string(*args, **kwargs) - return s.replace(b'\n', b'') # this is like Django's {% spaceless %} - -class MainHandler(BaseHandler): - @tornado.web.asynchronous - @tornado.gen.coroutine - def get(self): - http_client = tornado.httpclient.AsyncHTTPClient() - kills_url = 'https://zkillboard.com/api/kills/corporationID/98182803/limit/1' - losses_url = 'https://zkillboard.com/api/losses/corporationID/98182803/limit/1' - kills_res, losses_res = yield [http_client.fetch(kills_url), http_client.fetch(losses_url)] - kills = json.loads(kills_res.body.decode('utf-8')) - losses = json.loads(losses_res.body.decode('utf-8')) - kills = sorted(kills + losses, key=operator.itemgetter('killTime'), reverse=True) - self.render('home.html', kills=kills) - - -class CSSHandler(tornado.web.RequestHandler): - def get(self, css_path): - css_path = os.path.join(os.path.dirname(__file__), 'static', css_path) + '.less' - with open(css_path, 'r') as f: - self.set_header('Content-Type', 'text/css') - css = lessc.compile(f.read()) - self.write(css) - -if __name__ == '__main__': - tornado.web.Application( - handlers=[ - (r'/', MainHandler), - (r"/(css/.+)\.css", CSSHandler), - ], - template_path=os.path.join(os.path.dirname(__file__), 'templates'), - static_path=os.path.join(os.path.dirname(__file__), 'static'), - cookie_secret=config.web.cookie_secret, - debug=True, - ).listen(config.web.port) - print('Listening on :%d' % config.web.port) - tornado.ioloop.IOLoop.instance().start() diff --git a/web/static/css/base.less b/web/static/css/base.ccss index 714d5ab..e515323 100644 --- a/web/static/css/base.less +++ b/web/static/css/base.ccss @@ -1,37 +1,31 @@ -* { +*: box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -} -body { +body: margin: 0; padding: 0; height: 100%; background: #000; color: #ddd; font-family: sans-serif; -} -a { +a: text-decoration: none; color: #dde; -} -form { - input { +form: + input: background: #fff; border: 1px solid #cdd; padding: 5px 10px; } -} -.clear { +.clear: clear: both; -} -#wrapper { +#wrapper: width: 900px; margin: 50px auto; background: #111; -} |