summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylu <raylu@gridium.com>2013-10-19 18:30:23 -0700
committerraylu <raylu@gridium.com>2013-10-19 18:30:23 -0700
commit4fcc479ed7656f675491c3563eff6c966118a30e (patch)
tree4bea4baa7539af7ce612771c4f95cdc69667d23d
parentc6cb565f1216054fd386e0e5cd107cf7989a80e6 (diff)
downloadykill-4fcc479ed7656f675491c3563eff6c966118a30e.tar.xz
switch to cleancss
-rw-r--r--config.py1
-rw-r--r--config.yaml.example1
-rwxr-xr-xserver.py (renamed from web/server.py)25
-rw-r--r--web/static/css/base.ccss (renamed from web/static/css/base.less)20
4 files changed, 22 insertions, 25 deletions
diff --git a/config.py b/config.py
index 1f9be4d..46df4d4 100644
--- a/config.py
+++ b/config.py
@@ -14,6 +14,7 @@ class WebConfig(Config):
'port',
'host',
'cookie_secret',
+ 'debug',
])
class DBConfig(Config):
diff --git a/config.yaml.example b/config.yaml.example
index 37a6e17..d521366 100644
--- a/config.yaml.example
+++ b/config.yaml.example
@@ -2,6 +2,7 @@ web:
port: 8888
host: 'localhost:8888'
cookie_secret: 'dis is super sekrit'
+ debug: true
db:
host: localhost
diff --git a/web/server.py b/server.py
index 01475c1..7dcf2d3 100755
--- a/web/server.py
+++ b/server.py
@@ -1,19 +1,20 @@
#!/usr/bin/env python3
import json
-from lesscss import lessc
+import operator
+import os
+
+import cleancss
import tornado.gen
import tornado.httpclient
import tornado.ioloop
import tornado.web
-import operator
-import os
-import config
+from config import web as config
class BaseHandler(tornado.web.RequestHandler):
def render(self, *args, **kwargs):
- kwargs['host'] = config.web.host
+ kwargs['host'] = config.host
return super(BaseHandler, self).render(*args, **kwargs)
def render_string(self, *args, **kwargs):
@@ -36,11 +37,11 @@ class MainHandler(BaseHandler):
class CSSHandler(tornado.web.RequestHandler):
def get(self, css_path):
- css_path = os.path.join(os.path.dirname(__file__), 'static', css_path) + '.less'
+ css_path = os.path.join(os.path.dirname(__file__), 'web', 'static', css_path) + '.ccss'
with open(css_path, 'r') as f:
self.set_header('Content-Type', 'text/css')
- css = lessc.compile(f.read())
- self.write(css)
+ self.write(cleancss.convert(f))
+
if __name__ == '__main__':
tornado.web.Application(
@@ -50,8 +51,8 @@ if __name__ == '__main__':
],
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)
+ cookie_secret=config.cookie_secret,
+ debug=config.debug,
+ ).listen(config.port)
+ print('listening on :%d' % config.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;
-}