Browse Source

Add JavaScript compiler and minimal documentation

master
Peter J. Jones 6 years ago
parent
commit
f827c36a5f
4 changed files with 49 additions and 6 deletions
  1. 17
    0
      README.md
  2. 4
    2
      devalot-hakyll.cabal
  3. 25
    0
      src/Hakyll/Web/JavaScript.hs
  4. 3
    4
      src/Hakyll/Web/Sass.hs

+ 17
- 0
README.md View File

@@ -0,0 +1,17 @@
# Hakyll extensions for Devalot.com

Some small extensions for [Hakyll](http://jaspervdj.be/hakyll/) for
[Devalot.com](http://www.devalot.com).

* **Hakyll.Web.Heist:**

Use [Heist](https://github.com/snapframework/heist) templates with
Hakyll.

* **Hakyll.Web.JavaScript:**

Minimize JavaScript files.

* **Hakyll.Web.Sass:**

Compile `*.sass`/`*.scss` files and compress them.

+ 4
- 2
devalot-hakyll.cabal View File

@@ -1,6 +1,6 @@
name: devalot-hakyll
version: 0.1.1.0
synopsis: Hakyll utilities for Devalot.com
synopsis: Hakyll extensions for Devalot.com
license: BSD3
license-file: LICENSE
author: Peter Jones <pjones@pmade.com>
@@ -12,7 +12,9 @@ cabal-version: >=1.8

library
exposed-modules: Hakyll.Web.Heist
Hakyll.Web.JavaScript
Hakyll.Web.Sass
hs-source-dirs: src
ghc-options: -Wall
build-depends: base == 4.5.*
@@ -23,6 +25,6 @@ library
, errors == 1.4.*
, mtl == 2.1.*
, text == 0.11.*
, transformers == 0.3.*
, utf8-string == 0.3.*
, xmlhtml == 0.2.*
, hjsmin == 0.1.4.*

+ 25
- 0
src/Hakyll/Web/JavaScript.hs View File

@@ -0,0 +1,25 @@
{-

This file is part of the package devalot-hakyll. It is subject to the
license terms in the LICENSE file found in the top-level directory of
this distribution and at git://pmade.com/devalot-hakyll/LICENSE. No
part of devalot-hakyll package, including this file, may be copied,
modified, propagated, or distributed except according to the terms
contained in the LICENSE file.

-}

--------------------------------------------------------------------------------
module Hakyll.Web.JavaScript (jsCompiler) where

--------------------------------------------------------------------------------
import Control.Applicative ((<$>))
import Data.ByteString.Lazy.UTF8 (toString)
import Hakyll.Core.Compiler (Compiler, getResourceLBS)
import Hakyll.Core.Item (Item)
import Text.Jasmine (minify)

--------------------------------------------------------------------------------
-- | Compile a JavaScript file by minimizing it.
jsCompiler :: Compiler (Item String)
jsCompiler = fmap (toString . minify) <$> getResourceLBS

+ 3
- 4
src/Hakyll/Web/Sass.hs View File

@@ -10,10 +10,7 @@ contained in the LICENSE file.
-}

--------------------------------------------------------------------------------
module Hakyll.Web.Sass
( sassCompiler
, scssCompiler
) where
module Hakyll.Web.Sass (sassCompiler , scssCompiler) where

--------------------------------------------------------------------------------
import Hakyll.Core.Compiler (Compiler, getResourceString, makeItem)
@@ -22,10 +19,12 @@ import Hakyll.Core.UnixFilter (unixFilter)
import Hakyll.Web.CompressCss (compressCss)

--------------------------------------------------------------------------------
-- | Convert a @*.sass@ file into compressed CSS.
sassCompiler :: Compiler (Item String)
sassCompiler = toCSS "sass"

--------------------------------------------------------------------------------
-- | Convert a @*.scss@ file into compress CSS.
scssCompiler :: Compiler (Item String)
scssCompiler = toCSS "scss"


Loading…
Cancel
Save