Permalink
Browse files

CSS optimizations.

  • Loading branch information...
Kyle Marek-Spartz
Kyle Marek-Spartz committed Dec 5, 2014
1 parent afb8cbb commit 802be82df158a17e4e68615af661e89c4d4829ed
Showing with 26 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 build_css.sh
  3. +1 −0 css/default.css
  4. +11 −6 site.hs
  5. +12 −4 templates/default.html
@@ -12,3 +12,4 @@ presentations/*.html
.cabal-sandbox
cabal.sandbox.config
dist
css/combined.css
@@ -0,0 +1 @@
cat css/syntax.css css/markdown.css css/default.css > css/combined.css
@@ -1,3 +1,4 @@
/* default.css */
iframe {
border: none;
}
17 site.hs
@@ -2,9 +2,10 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where

import Data.Monoid ((<>))
import Data.List (isPrefixOf, isSuffixOf)
import System.FilePath (takeFileName)
import Control.Applicative ((<$>))
import Data.Monoid ((<>))
import Data.List (isPrefixOf, isSuffixOf)
import System.FilePath (takeFileName)

import Text.Pandoc.Options ( WriterOptions
, writerHTMLMathMethod
@@ -40,7 +41,7 @@ main = hakyllWith config $ do

match staticContent $ idR copyFileCompiler

match "css/*" $ idR compressCssCompiler
-- match "css/*" $ idR compressCssCompiler

match "posts/*" $ do
route $ setExtension "html"
@@ -55,7 +56,7 @@ main = hakyllWith config $ do
create ["posts/tags/index.html"] $ idR $ tagsCompiler tags

create ["blog.html"] $ idR $ postsCompiler tags

create ["index.html"] $ idR $ homeCompiler tags

create ["atom.xml"] $ idR $ feedCompiler tags
@@ -64,6 +65,7 @@ main = hakyllWith config $ do

match "templates/*" $ compile templateCompiler

match "css/combined.css" $ compile cssTemplateCompiler

-------------------------------------------------------------------------------

@@ -75,6 +77,9 @@ defaultTemplateWith template ctx =
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls

cssTemplateCompiler :: Compiler (Item Template)
cssTemplateCompiler = cached "Hakyll.Web.Template.cssTemplateCompiler" $
fmap (readTemplate . compressCss) <$> getResourceString

tagCompiler :: Tags -> String -> Pattern -> Compiler (Item String)
tagCompiler tags tag pattern = do
@@ -181,7 +186,7 @@ writerOptions = defaultHakyllWriterOptions
config :: Configuration
config = defaultConfiguration
{ ignoreFile = ignoreFile'
, deployCommand = "pushd presentations && ./build.sh && popd && ./build_cv.sh && ./build_sitemap.sh && pushd _site && widely push && popd"
, deployCommand = "./build_css.sh && pushd presentations && ./build.sh && popd && ./build_cv.sh && ./build_sitemap.sh && pushd _site && widely push && popd"
}
where
ignoreFile' path
@@ -7,10 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="$if(description)$$description$$else$$title$ – kms$endif$">
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/syntax.css"/>
<link rel="stylesheet" type="text/css" href="/css/markdown.css" />
<link href='http://fonts.googleapis.com/css?family=EB+Garamond|Inconsolata|Source+Sans+Pro:300,300italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/css/default.css"/>
<style>$partial("css/combined.css")$</style>
</head>
<body>
<header>
@@ -52,6 +49,17 @@ <h1>
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
$endif$<script>
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet'; l.type = 'text/css';
l.href = 'http://fonts.googleapis.com/css?family=EB+Garamond|Inconsolata|Source+Sans+Pro:300,300italic';
var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
};
var raf = requestAnimationFrame || mozRequestAnimationFrame ||
webkitRequestAnimationFrame || msRequestAnimationFrame;
if (raf) raf(cb);
else window.addEventListener('load', cb);
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

0 comments on commit 802be82

Please sign in to comment.