• This repository has been archived on 14/Dec/2023
  • Stars
    star
    106
  • Rank 325,807 (Top 7 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Development kit for the Javascript language

JavaScript development kit for prismic.io

DEPRECATED please use https://github.com/prismicio/prismic-javascript

npm version Build Status Code Climate Test Coverage

Installation

NPM

npm install prismic.io --save

CDN

https://unpkg.com/prismic.io/dist/prismic.io.min.js

(You may need to adapt the version number)

Downloadable version

On our release page: https://github.com/prismicio/javascript-kit/releases.

The kit is universal, it can be used:

  • Server-side with NodeJS
  • Client-side as part of your build with Browserify, Webpack (you need a Promise polyfill to support IE11 and below)
  • Client-side with a simple script tag

Starter kits

For new project, you can start from a sample project:

Usage

To fetch documents from your repository, you need to fetch the Api data first.

var Prismic = require('prismic.io');

Prismic.api("http://your_repository_name.prismic.io/api", function(error, api) {
  var options = {}; // In Node.js, pass the request as 'req' to read the reference from the cookies
  api.query("", options, function(err, response) { // An empty query will return all the documents
    if (err) {
      console.log("Something went wrong: ", err);
    }
    console.log("Documents: ", response.documents);
  });
});

All asynchronous calls return ES2015 promises, so alternatively you can use them instead of callbacks.

var Prismic = require('prismic.io');

Prismic.api("https://lesbonneschoses.prismic.io/api").then(function(api) {
  return api.query(""); // An empty query will return all the documents
}).then(function(response) {
  console.log("Documents: ", response.results);
}, function(err) {
  console.log("Something went wrong: ", err);
});

See the developer documentation or the API documentation for more details on how to use it.

Contribute to the kit

Contribution is open to all developer levels, read our "Contribute to the official kits" documentation to learn more.

Install the kit locally

Source files are in the lib/ directory. You only need Node.js and npm to work on the codebase.

npm install
npm test

Documentation

Please document any new feature or bugfix using the JSDoc syntax. You don't need to generate the documentation, we'll do that.

If you feel an existing area of code is lacking documentation, feel free to write it; but please do so on its own branch and pull-request.

If you find existing code that is not optimally documented and wish to make it better, we really appreciate it; but you should document it on its own branch and its own pull request.

License

This software is licensed under the Apache 2 license, quoted below.

Copyright 2013-2016 Zengularity (http://www.zengularity.com).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

prismic-gatsby

Gatsby plugins for building websites using Prismic
TypeScript
313
star
2

slice-machine

A series of tools for developing and deploying website sections with Prismic
TypeScript
286
star
3

prismic-client

The official JavaScript + TypeScript client library for Prismic
TypeScript
160
star
4

prismic-react

React components and hooks to fetch and present Prismic content
TypeScript
151
star
5

slice-machine-pre-alpha

A machine made to slice stuff (mostly components)
JavaScript
90
star
6

awesome-prismic

A curated list of awesome things related to Prismic
89
star
7

prismic-vue

Vue plugin, components, and composables to fetch and present Prismic content
TypeScript
65
star
8

prismic-next

Helpers to integrate Prismic into Next.js apps
TypeScript
51
star
9

reactjs-starter

JavaScript
49
star
10

nuxtjs-website

Vue
46
star
11

prismic-dom

Set of helpers to manage Prismic data
JavaScript
44
star
12

vuejs-starter

Vue.js starter project with content managed in Prismic
Vue
43
star
13

vue-essential-slices

A set of professionally made, accessible Vue components, linked to a (Prismic) backend
Vue
41
star
14

prismic-cli

Prismic command line tool
TypeScript
39
star
15

javascript-nodejs-starter

Starter project for NodeJS – Works with any prismic.io repository
JavaScript
34
star
16

nodejs-sdk

Prismic.io Starter for NodeJS projects
Pug
33
star
17

ruby-rails-starter

Starter project for Ruby on Rails – Works with any prismic.io repository
Ruby
32
star
18

reactjs-website

JavaScript
28
star
19

prismic-gatsby-coffee-sample

JavaScript
28
star
20

universal-react-website

JavaScript
25
star
21

php-laravel-starter

Php Laravel Starter for prismic.io
PHP
23
star
22

gatsby-multi-language-site

Multi-language project with Gatsby & Prismic
JavaScript
22
star
23

scala-play-starter

Starter project for Scala, Play – Works with any prismic.io repository
Scala
21
star
24

prismic-svelte

Svelte components and helpers to fetch and present Prismic content
Svelte
21
star
25

prismic-richtext

A parser and serializer for Prismic's Rich Text format
TypeScript
18
star
26

essential-slices

Nicely made React components, connected to a Prismic backend
JavaScript
17
star
27

prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
TypeScript
17
star
28

javascript-jquery-starter

Starter project for JavaScript & JQuery – Works with any prismic.io repository
HTML
17
star
29

nodejs-blog

CSS
16
star
30

prismic-helpers

Set of helpers to manage Prismic data
TypeScript
15
star
31

prismic-demo

CSS
14
star
32

php-plain-starter

Starter project for plain PHP – Works with any prismic.io repository
PHP
14
star
33

apollo-link-prismic

TypeScript
14
star
34

angular2-starter

TypeScript
13
star
35

javascript-backbone-starter

Starter project for Javascript, BackboneJS – Works with any prismic.io repository
JavaScript
12
star
36

prismic-toolbar

An embeddable UI for Prismic content and previews directly on your website.
JavaScript
12
star
37

vuejs-blog

Vue
11
star
38

php-symfony-starter

Starter project for Symfony – Works with any prismic.io repository
PHP
11
star
39

prismic-types

Type definitions for Prismic content, models, and APIs
TypeScript
11
star
40

nodejs-example-snipcart

CSS
11
star
41

java-play-starter

Starter project for Java, Play – Works with any prismic.io repository
Java
10
star
42

vuejs-website

Vue
9
star
43

reactjs-blog

JavaScript
9
star
44

nodejs-multi-language-site

Sample Multi-language Node.js website with Prismic CMS
CSS
9
star
45

java-springmvc-starter

Starter project for Java, Spring MVC – Works with any prismic.io repository
Java
9
star
46

python-django-starter

Starter project for Django – Works with any prismic.io repository
Python
8
star
47

SymfonyBundle

Inntegrates the http://prismic.io php-kit with the Symfony Framework
PHP
8
star
48

prismic-netlify-showcase

An example of an online coffee shop website, built with React, with content hosted on Prismic, and frontend deployed on Netlify
JavaScript
8
star
49

dotnet-starter-kit

C#
8
star
50

prismic-mock

Generate mock Prismic documents, fields, Slices, and models for development and testing environments
TypeScript
8
star
51

nodejs-website

CSS
7
star
52

react-graphql-pagination-example

Example React website with GraphQL, Previews, & Pagination
JavaScript
6
star
53

gatsby-getting-started-tutorial

A simple tutorial project to get started with Prismic & Gatsby.js
JavaScript
6
star
54

slice-simulator

Preview and develop Prismic slices fast with minimal configuration
TypeScript
6
star
55

prismic-snippets

Prismic snippets for VS Code, Vim, Sublime, and IntelliJ
Java
6
star
56

prismic-website-demo

CSS
5
star
57

blogtemplate

PHP
5
star
58

javascript-singlepage

JavaScript
5
star
59

php-website

PHP
4
star
60

sm-documentation

Vue
4
star
61

prismic-custom-types-client

JavaScript client to interact with the Prismic Custom Types API
TypeScript
4
star
62

wp2prismicio

Scala
3
star
63

php-laravel-sample

PHP
3
star
64

android-starter

Starter project for Java, Android – Works with any prismic.io repository
Java
3
star
65

prismic-vuejs-showcase

Vue
3
star
66

slice-machine-init

Setup Slice Machine in one command.
3
star
67

repository

prismic.io kits repository
2
star
68

php-blog

PHP
2
star
69

events-page

Events page repository
JavaScript
2
star
70

hack-plain-starter

PHP
2
star
71

hack-kit

PHP
2
star
72

interactive-console

TypeScript
1
star
73

gamingrealms-pocketfruity-demo

CSS
1
star
74

social-cards-template

Template and custom type for customised social cards
HTML
1
star
75

ios-starter

Starter project for the iOS platform
Objective-C
1
star
76

editor-prototype

TypeScript
1
star
77

user-test-sm

JavaScript
1
star
78

slicemachine-adapter-next

Slice Machine adapter for Next.js
TypeScript
1
star
79

slicemachine-plugin-kit

A set of helpers to develop and run Slice Machine plugins
TypeScript
1
star
80

nodejs-slices

A Taste of Building Website Pages using Node.js and Content Slices
CSS
1
star
81

gamingrealms-slingo-demo

JavaScript
1
star
82

php-installer

CLI to bootstrap Prismic.io projects in PHP
PHP
1
star
83

gatsby-starter-default

CSS
1
star
84

rg-demo

CSS
1
star
85

javascript-blogtemplate

JavaScript
1
star
86

nodejs-gallery-slice

JavaScript
1
star
87

babel-transform-config

Use Babel to transform a JS configuration file (like Nuxt & Next config files)
JavaScript
1
star