allcount/allcountjs

favicon.png override

yieme opened this issue · 3 comments

yieme commented

I'm attempting to override the default favicon to a png. I've added the viewPaths injection:

injection.bindMultiple('viewPaths', ['myViewPathProvider']);
injection.bindFactory('myViewPathProvider', function () {
    return [path.join(__dirname, 'app/views')];
});

var server    = injection.inject('allcountServerStartup')
server.startup(function (errors) { })

I copied node_modules/allcountjs/views/main-mixins.jade to app/views/ and edit the copy with the png update. When I run, I get no change.

If I delete node_modules/allcountjs/views/main-mixins.jade and run, then it works as I expected. According to https://allcountjs.com/docs/server#views the last bound dependency should come first. I can hackup node_modules/allcountjs/views/ easy enough on my local machine but can't deploy this to heroku.

Thoughts?

yieme commented

Work around, use fs to delete the allcountjs version of the file:

injection.bindFactory('gitRepoUrl', 'app')

var fs = require('fs')
fs.unlinkSync(path.join(__dirname, 'node_modules/allcountjs/views/main-mixins.jade') );

injection.bindMultiple('viewPaths', ['myViewPathProvider']);
injection.bindFactory('myViewPathProvider', function () {
    return [path.join(__dirname, 'app/views')];
});

var server    = injection.inject('allcountServerStartup')
server.startup(function (errors) {
   // ...
})
do4 commented

+1

yieme commented

Fixed by changing the gitRepoUrl and viewPaths to app_config and putting new main-mixins.jade in app_config/

injection.bindFactory('gitRepoUrl', 'app_config')
injection.bindMultiple('viewPaths', ['myViewPathProvider']);
injection.bindFactory('myViewPathProvider', function () {
    return [path.join(__dirname, 'app_config')];
});

var server    = injection.inject('allcountServerStartup')
server.startup(function (errors) {
  // ...
})