Collection of third party snippets (Google Analytics, Disqus, Tweet Button & Web Font Loader), you can easily add to your Punch templates.
-
Install the package
npm install punch-thirdparty-snippets-helper
-
Open your Punch project's configurations (
config.json
) and add the following:"plugins": { "helpers": { "thirdparty_snippets_helper": "punch-thirdparty-snippets-helper" } }
-
You must then define the configurations for the snippets you wish to use as follows:
"thirdparty_snippets": { "google_analytics": { "universal": true "property_id": "UA-XXXXXX-X" "property_domain": "yoursite.com" }, "disqus": { "shortname": "username" }, "twitter": { "user": "screename" }, "web_fonts": { "google": { "families": ['Droid Sans', 'Droid Serif'] } }, }
Here is a full list of options available for each snippet:
Google Analytics
- universal: (optional, default to
false
) - iftrue
, use the new universal google analytics tracking code - property_domain (optional, default to
auto
) - only use whenuniversal
istrue
- proterty_id (required) - The property ID for the site you want to track (Learn More)
- async - Whether to load the script in asynchronous mode, which will start tracking the events immediately without blocking the page rendering (default: true)
Disqus
- shortname (required) - Shortname provided for your discuss account.
Tweet Button
- via - Screen name of the user to attribute the Tweet to
- count - Count box position values: none, horizontal, vertical (default: none)
- size - The size of the rendered button values: medium, large (default: medium)
WebFont Loader
You must provide the configuration of fonts to load as defined in the WebFont Loader library
For example to use Google Fonts:
"web_fonts": {
"google": {
"families": ['Droid Sans', 'Droid Serif']
}
}
Typekit
To use Typekit fonts exclusively, use the Typekit snippet.
-
id (required) - Typekit account ID
"typekit": { "id": 'xxxxxx' }
Copyright (c) 2012 Licensed under the MIT license.