GithubHelp home page GithubHelp logo

Serve a unique favicon.ico per project about jus HOT 12 CLOSED

jus avatar jus commented on May 23, 2024
Serve a unique favicon.ico per project

from jus.

Comments (12)

billiegoose avatar billiegoose commented on May 23, 2024 1

Oh boy! My identicon PR already is merged and on npm! :)

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

No code to merge yet, because I like being able to install jus and so we can't add 'identicon' as a dependency yet. But when we do, my code looks something like this:

// lib/server.js
const express  = require('express')
const cors     = require('cors')
...
const identicon = require('identicon')
const favicon   = require('serve-favicon')

var server = module.exports = express()
server.use(cors())

// Create unique favicon from the current working directory
var faviconPNG = identicon.generateSync({id: process.cwd(), size: 16})
server.use(favicon(faviconPNG))
...

from jus.

jdormit avatar jdormit commented on May 23, 2024

Looks good, but is there a check to serve an existing favicon if one exists?

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

Right, obviously an actual favicon.ico would take priority. I suppose that would mean putting server.use(favicon(faviconPNG)) farther down, as a fallback for the static server.

from jus.

zeke avatar zeke commented on May 23, 2024

So this is just for development? Or do you also intend to kick out a default favicon in the build process if none exists?

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

I was just thinking of during development, to help me keep my tabs straight. Do you think people would want a defacto favicon in the built version?

from jus.

zeke avatar zeke commented on May 23, 2024

Do you think people would want a defacto favicon in the built version?

Probably not. Just clarifying your intent. :)

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

How seriously do we take IE support? Apparently some browser STILL doesn't accept PNG favicons. There's a to-ico module that can convert a PNG buffer to an ICO buffer, but it'll drag in a bunch more dependencies.

Edit: Correction! I have maligned IE unjustly. It does take PNG favicons. It is just very VERY stubborn about caching favicons. (Had to delete the browser history to uncache them.)

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

Edit: Ignore my original grumpy old man statement. Feel free to discuss the feature / concept in this thread and critique the implementation in the pull request. Apparently in the grand scale of things that is supposed to make life less confusing.

(grump grump grump) Is there not a way to turn an existing issue into a pull request? I feel like the discussion should move to the pull request #63 but it's annoying that it's gonna fragment the conversation thread by doing that.

from jus.

zeke avatar zeke commented on May 23, 2024

Is there not a way to turn an existing issue into a pull request?

Pretty sure you can still do it with https://hub.github.com/

from jus.

billiegoose avatar billiegoose commented on May 23, 2024

Oh my. Googling that led to some loooong discussion threads. It sounds like the recommended practice is to separate concerns: issues for the bug / feature itself, pull-requests for the implementation details. Now I know, let's go with the flow. :)

from jus.

jdormit avatar jdormit commented on May 23, 2024

Merged in #63

from jus.

Related Issues (20)

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.