Code Monkey home page Code Monkey logo

hakyll-favicon's Introduction

hakyll-favicon Build Status

This library allows you to easily add favicons to your hakyll website. You provide one SVG image and the library will convert it to different resolutions and generate the corresponding html.

Dependencies

This library depends on ImageMagick to convert the images.

Usage

First, add a faviconsRules that points to your main favicon in your Site.hs file like this:

main = hakyll $ do
  faviconsRules "images/favicon.svg" -- path to your favicon
  ...

Second, add a favicons field in your template head:

<head>
  ...
  $favicons$
</head>

Finally add the favicons context to your template context:

main = hakyll $ do
  ...
  match "index.html" $ do
    ...
    let ctx = ... `mappend`
              ... `mappend`
              faviconsField `mappend` -- add this
              defaultContext
    ...

The example directory provides a minimal working example of this.

Example

First, build the example:

stack build

Then build the example page:

stack exec example build

Or you can start a local server to serve the generated page:

stack exec example watch

Generated favicons

The following favicons are generated:

target format sizes description
all .ico 32, 64 basic favicon
all .png 32 basic favicon
iOS .png 144 third-generation iPad with high-resolution Retina display
iOS .png 114 iPhone with high-resolution Retina display
iOS .png 72 first- and second-generation iPad
iOS, Android .png 57 non-Retina iPhone, iPod Touch, and Android 2.1+ devices

hakyll-favicon's People

Contributors

elaye avatar

Stargazers

 avatar  avatar  avatar  avatar

hakyll-favicon's Issues

[ERROR] convert: createProcess: posix_spawnp: does not exist (No such file or directory)

Information

Os : NixOS 22.05
tools : cabal2nix 2.18.0

How to reproduce :

git clone [email protected]:elaye/hakyll-favicon.git
cd hakyll-favicon
nix-shell -p cabal2nix
cabal2nix --shell . > shell.nix
nix-build shell.nix
./result/bin/example build

Expected outcome :

site build success and hakyll-favicon can provide favicons

More Info:

shell.nix :

{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:

let

  inherit (nixpkgs) pkgs;

  f = { mkDerivation, base, filepath, hakyll, lib }:
      mkDerivation {
        pname = "hakyll-favicon";
        version = "0.1.0";
        src = ./.;
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base filepath hakyll ];
        executableHaskellDepends = [ base hakyll ];
        testHaskellDepends = [ base ];
        homepage = "https://github.com/elaye/hakyll-favicon#README.md";
        license = lib.licenses.bsd3;
      };

  haskellPackages = if compiler == "default"
                       then pkgs.haskellPackages
                       else pkgs.haskell.packages.${compiler};

  variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;

  drv = variant (haskellPackages.callPackage f {});

in

  if pkgs.lib.inNixShell then drv.env else drv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.