Socket
Book a DemoInstallSign in
Socket

prismic-static

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prismic-static

A plugin for prismic.io with helper functions for static-site generating.

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Prismic static

An npm module with helpers for using prismic.io javascript API with javascript-based static-site generators.

Install

npm install prismic-static

Usage

var PrismicStatic = require( 'prismic-static' );

var myPrismic = new PrismicStatic( '<YOUR_API_KEY_HERE>' );

var collections = myPrismic.getAllDocuments( function( docs ) {
    ...
});

Helpers

getAllDocuments( callback )

Fetches all document from a repository given the API key

Arguments

  • callback (function) - the callback function to be executed when the fetch has been completed.

Returns

  • ( object ) - with keys collections and tags. Each of the values is itself an object containing keys for each respective collection and tag type. The value of each of these keys is an array of prismic documents. Ex:
    {
        collections: {
            posts: [documents],
            pages: [documents],
            projects: [documents]
        },
        tags: {
            design: [documents],
            development: [documents],
            css: [documents]
        }
    }

getDocumentsByType( type, callback )

Fetches all documents of a specified type from the repository.

Arguments

  • type ( string ) - the custom-type name that you'd like to fetch.
  • callback ( function ) - the callback function to be executed when the fetch has been completed.

Returns

  • ( object ) - with keys for document type and corresponding values as an array of prismic documents. Ex:
    {
        posts: [documents],
        pages: [documents],
        projects: [documents]
    }

getTaggedDocuments( type, callback )

Fetches all tagged documents for a specified type and sorts by tag name.

Arguments

  • type ( string ) - the custom-type name that you'd like to fetch.
  • callback ( function ) - the callback function to be executed when the fetch has been completed.

Returns

  • ( object ) - with keys for each tag name and corresponding values as an array of prismic documents. Ex:
    {
        design: [documents],
        development: [documents],
        css: [documents]
    }

FAQs

Package last updated on 17 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.