@hatchly/nuxt-snippets-module
Official nuxt integration for the Hatchly/Snippets module
Last updated 5 months ago by samturrell .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @hatchly/nuxt-snippets-module 
SYNC missed versions from official npm registry.

Nuxt Hatchly Snippets Module

Module to easily fetch and access snippets from the hatchly/snippets api

Installation

yarn add @hatchly/nuxt-snippets-module

Register the module in your nuxt applications config file:

module.exports = {
    // Nuxt config
    modules: {
        // Other Modules
        ['@hatchly/nuxt-snippets-module', {
            // Options
        }],
    },

    hatchly: {
        snippets: {
            // Options can also be defined here
        },
    },
};

Add the API url to your .env:

API_BASE=http://my-application.localhost

Options

The options object can contain the following values:

{
    apiBase: '',
    apiPath: '',
    apiUrl: '',
},

Each option is described below.

apiBase

The url of your Hatchly site. This is should be updated in your .env rather than hardcoding a value here.

  • Default: process.env.API_BASE
  • Type: string

apiPath

The path to the snippets endpoint. This can be modified in the Hatchly api config file, so make sure this path corresponds to that value.

  • Default: '_hatchly/api/snippets'
  • Type: string

apiUrl

The full api url to the snippets module. By default this is made up of the apiBase and the apiUrl, but can be overwritten in full.

  • Default: ${ process.env.API_BASE }/_hatchly/api/snippets
  • Type: string

Usage

All snippets are downloaded server side on page load.

To access a snippet you can use the global $snippet() method:

{{ $snippet('snippet_key') }}

Current Tags

  • 1.2.0                                ...           latest (5 months ago)

3 Versions

  • 1.2.0                                ...           5 months ago
  • 1.1.0                                ...           5 months ago
  • 1.0.0                                ...           5 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |