Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apostrophecms/apostrophe-favicons
Generates and links a set of favicons from an image in the media library
https://github.com/apostrophecms/apostrophe-favicons
Last synced: about 2 months ago
JSON representation
Generates and links a set of favicons from an image in the media library
- Host: GitHub
- URL: https://github.com/apostrophecms/apostrophe-favicons
- Owner: apostrophecms
- License: mit
- Created: 2018-05-18T19:24:08.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2022-02-08T15:54:17.000Z (almost 3 years ago)
- Last Synced: 2024-11-05T05:19:42.746Z (about 2 months ago)
- Language: JavaScript
- Size: 122 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![CircleCI](https://circleci.com/gh/apostrophecms/apostrophe-favicons/tree/master.svg?style=svg)](https://circleci.com/gh/apostrophecms/apostrophe-favicons/tree/master)
# apostrophe-favicons
## Editor-controlled favicon generator of various formats. Automatic handling of their link tags.### Overview
Apostrophe module that generates a number of differently sized favicon image formats. The image itself is an `apostrophe-images` widget that gets appended to the `apostrophe-global`, which is easily manipulated by an editor.
Unlike version 1.x, this module uses `imagemagick` to perform image conversions. This is a standard prerequisite for the use of ApostropheCMS with good performance when uploading images, so you should already have it installed in both dev and production environments. See the [getting started guide](https://docs.apostrophecms.org/apostrophe/getting-started/setting-up-your-environment#install-imagemagick) and the [production guide](https://docs.apostrophecms.org/apostrophe/apostrophe-devops/deployment/deployment).
### Note
Performance is much better than 1.x, however there are no options to pass on to the `favicon` npm module because we do not use it.### Example config
in `app.js````js
var apos = require('apostrophe')({
shortName: 'yourSite',
modules: {// Enable the module, enhances apostrophe-global
'apostrophe-favicons': {},
// Now apostrophe-global has some new options
'apostrophe-global': {
faviconDestinationDir: '/fav/',
// Defaults to `/favicons/`. This is an uploadfs path, it will become /uploads/favicons/ on a server
}}
});
```
### Outputting the link tags
After you have selected and generated your favicons, you can use the following macro to output the markup into your template.```html
{% extends "outerLayoutBase.html" %}
{% import 'apostrophe-favicons:faviconMacros.html' as favicons %}
...
{% block extraHead %}
{{ favicons.renderLinks(apos, data.global) }}
{% endblock %}
```