Martin Hilscher
2015-09-21 12:02:22 UTC
Hi everybody,
I currently optimizing my site for faster loading, part of that is to
inline the css styles. So instead of having a <style src="path-to-file"/>
loading another file, I have a <style> *all css here* </style> at the
beginning of every html file.
I don't want to use an external tool to generate the css (from scss) then
copy that files content into a partial and then run site build. This seems
to error prone. So I added a field $css$ as follows and added it to the
context of the template that generates the head of the html files.
field "css" (\_ -> return . itemBody =<< withItemBody (unixFilter "sass"
["-I", ".", "--no-cache", "--scss", "--compass", "--style", "compressed"])
=<< load "css/style.scss"),
This works perfectly but, calls the sass process for every file that is
generated. Obviously the scss files won't change in between two files
during the build process of the site.
So here is my question: Do you see any better way of doing this? Especially
not calling sass for every file.
Best regards,
Martin
P.S.: Should you like to have a look at the full code
https://github.com/xinitrc/xinitrc.de
I currently optimizing my site for faster loading, part of that is to
inline the css styles. So instead of having a <style src="path-to-file"/>
loading another file, I have a <style> *all css here* </style> at the
beginning of every html file.
I don't want to use an external tool to generate the css (from scss) then
copy that files content into a partial and then run site build. This seems
to error prone. So I added a field $css$ as follows and added it to the
context of the template that generates the head of the html files.
field "css" (\_ -> return . itemBody =<< withItemBody (unixFilter "sass"
["-I", ".", "--no-cache", "--scss", "--compass", "--style", "compressed"])
=<< load "css/style.scss"),
This works perfectly but, calls the sass process for every file that is
generated. Obviously the scss files won't change in between two files
during the build process of the site.
So here is my question: Do you see any better way of doing this? Especially
not calling sass for every file.
Best regards,
Martin
P.S.: Should you like to have a look at the full code
https://github.com/xinitrc/xinitrc.de
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.