未加星标

A Simple Template for Hakyll, SASS, and Foundation

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

For simple web sites a static web site generator is often sufficient. Jekyll is such a well know generator. In our company we use JBake , because of its good integration in the Java infrastructure. More information on that is found here: Integration of JBake in Maven Static Websites .

In my nonbusiness life, I like to play with Haskell . This is why I used Hakyll for a small personal web site. I wanted it to be responsive and choose to use Foundation . To do some styling of the Foundation classes I needed to use SASS and embed it into Hakyll. It took me about two hours to put everything together. To save this time in the future, I extracted a small template with everything in it.

You can find this template onGitHub: https://github.com/tnfink/simple-hakyll-sass-foundation-template . It is based on the Haskell Tool Stack , which must be installed beforehand.

To get the template up and running, first clone it:

git clone https://github.com/tnfink/simple-hakyll-sass-foundation-template.git

Then you need to build it. The first time it takes a little bit longer, because stack downloadsthe needed third party packages.

cd simple-hakyll-sass-foundation-template stack build

If everything went fine, you have a web site generator built with Haskell. Nowrun it with an embedded web server:

stack exec site watch

The site is now available at:http://127.0.0.1:8000/


A Simple Template for Hakyll, SASS, and Foundation

The project structure is pretty simple. The directories htmls , js , and images contains artifacts, which are directly copied into thegenerated site. The site uses only onetemplate: templates/default.html . This template is used by two pages located in pages . The complete Foundation SASS distribution is included in scss/3rdParty/foundation . The site-specific styling is in scss/project/styling.scss .

In site.hs all the Hakyll wiring is done. If you understand Hakyll it should be easy to understand how it works. Even without a thorough comprehension of Hakyll the code should be readable.

For my small project, this setup was a good choice. You can look at the result here . The only annoying thing for me, is that an error in the SASS files breaks the watch server of Hakyll. This is probably because of the integration of the binary SASS library. With plain Haskell libraries, errors do not stop the watch server.

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: SASGitGitHubJava
分页:12
转载请注明
本文标题:A Simple Template for Hakyll, SASS, and Foundation
本站链接:http://www.codesec.net/view/482066.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(27)