Make the reset CSS styles inline

This commit is contained in:
Kovid Goyal 2016-04-09 09:50:49 +05:30
parent 1b413d27f9
commit 25b631efad
2 changed files with 10 additions and 2 deletions

View File

@ -6,7 +6,6 @@
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png"> <link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" href="static/reset.css"></link>
</head> </head>
<body> <body>
<div id="page_load_progress"> <div id="page_load_progress">
@ -22,9 +21,16 @@
} }
</style> </style>
</div> </div>
<!-- reset styles {{{ -->
<style type="text/css">
RESET_STYLES
</style>
<!-- }}} -->
<!-- SVG icon definitions {{{ --> <!-- SVG icon definitions {{{ -->
ICONS ICONS
<!-- }}} --> <!-- }}} -->
<!-- main.js {{{ --> <!-- main.js {{{ -->
<script id="main_js">MAIN_JS</script> <script id="main_js">MAIN_JS</script>
<!-- }}} --> <!-- }}} -->

View File

@ -104,6 +104,8 @@ def compile_srv():
g = {'__file__': iconf} g = {'__file__': iconf}
execfile(iconf, g) execfile(iconf, g)
icons = g['merge']().encode('utf-8') icons = g['merge']().encode('utf-8')
with lopen(os.path.join(base, 'resources', 'content-server', 'reset.css'), 'rb') as f:
reset = f.read()
rapydscript_dir = os.path.join(base, 'src', 'pyj') rapydscript_dir = os.path.join(base, 'src', 'pyj')
rb = os.path.join(base, 'src', 'calibre', 'srv', 'render_book.py') rb = os.path.join(base, 'src', 'calibre', 'srv', 'render_book.py')
with lopen(rb, 'rb') as f: with lopen(rb, 'rb') as f:
@ -113,7 +115,7 @@ def compile_srv():
with lopen(fname, 'rb') as f: with lopen(fname, 'rb') as f:
js = compile_pyj(f.read(), fname).replace('__RENDER_VERSION__', rv).encode('utf-8') js = compile_pyj(f.read(), fname).replace('__RENDER_VERSION__', rv).encode('utf-8')
with lopen(os.path.join(base, 'index.html'), 'rb') as f: with lopen(os.path.join(base, 'index.html'), 'rb') as f:
html = f.read().replace(b'MAIN_JS', js).replace(b'ICONS', icons) html = f.read().replace(b'RESET_STYLES', reset, 1).replace(b'ICONS', icons, 1).replace(b'MAIN_JS', js, 1)
with lopen(os.path.join(base, 'index-generated.html'), 'wb') as f: with lopen(os.path.join(base, 'index-generated.html'), 'wb') as f:
f.write(html) f.write(html)