GithubHelp home page GithubHelp logo

tipe-vue-example's Introduction

Getting Started with Tipe using Vue

Configuration for vue/webpack/tipe-loader

Tipe works seamlessly with Vue

Webpack

tipe-loader

Installation

  npm install -dev webpack tipe-loader

// Or

  yarn add --dev webpack tipe-loader

Setup

Find your API Key and Org Secret key on Tipe Dashboard under API Keys.

API Keys UI

Configuration

Setup your webpack.config.js file.

Replace YOUR_API_KEY_HERE and YOUR_ORG_KEY_HERE with the keys you found on the Tipe Dashboard.

const webpack = require('webpack');
const path = require('path');

module.exports = {
  entry: './src/main.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    publicPath: '/dist/',
    filename: 'build.js'
  },
  module: {
    rules: [
      // ... babel-loader
      },
      {
        test: /\.tipe$/,
        use: [
          {
            loader: 'tipe-loader',
            options: {
              apiKey: 'YOUR_API_KEY_HERE',
              orgKey: 'YOUR_ORG_KEY_HERE'
            }
          }
        ]
      }
    ]
  }
};

NOTE:

tipe-loader must be below your babel-loader in your webpack.config file.

Package.json

In your package.json add a build command like so:

{
  "scripts": {
    "build": "webpack"
  },
}

Tipe File

Create your .tipe file and follow the GraphQL schema. Find your Document ID:

You can find the Document ID in the API tab when viewing your Document and press [Run GraphQL]

  • replace YourDoc with any alias you like
  • replace YOUR_DOCUMENT_ID with the id of your document
  • replace YourDocumentTemplate with the Name of your Document's Template

If you need help querying the right data, check the Example Code found after clicking [Run GraphQL].

query Tipe {
  YourDoc: YourDocumentTemplate(id: "YOUR_DOCUMENT_ID") {
    title
    subtitle
    section1
    section2
    section3
    _meta {
      id
      name
      updatedAt
      createdAt
      published
    }
  }
}

Adding Tipe to your .vue file.

Your data is ready syncronously at run time. Since our data is fetched during build-time we have it immediately and can include our Landing default data when our component is created.

Add your .tipe file to your .vue file like so:

  </div>
</template>

<script>
import { Landing } from './example.tipe';

export default {
  name: 'app',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      landing: Landing
    }
  }
}
</script>

<style>

Run your current build like so:

  npm run build
  yarn build

tipe-vue-example's People

Contributors

dtarellano avatar patrickjs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.