Giter Club home page Giter Club logo

vue-pronto's Introduction

vue-pronto

NPM version Build Status Dependency Status Coverage percentage Greenkeeper badge Codacy Badge

Rendering Engine for turning Vue files into Javascript Objects

Installation

$ npm install --save vue-pronto

Usage

Include the library at the top level like so

const Pronto = require('vue-pronto');

Then init the renderer

const renderer = new Pronto({object});

This returns 2 main functions. It takes 3 params, 2 required and one optional.

renderer.RenderToString(componentPath, data, [vueOptions]);
renderer.RenderToStream(componentPath, data, [vueOptions]);

Both methods return a promise. Stream returns a stream, and String returns a string.

RenderToStream

renderer.RenderToStream(vuefile, data, vueOptions) ⇒ Promise

renderToStream returns a stream from res.renderVue to the client

Kind: instance method of Renderer Returns: Promise - - Promise returns a Stream

Param Type Description
vuefile string full path to .vue component
data Object data to be inserted when generating vue class
vueOptions Object vue options to be used when generating head

RenderToString

renderer.RenderToString(vuefile, data, vueOptions) ⇒ Promise

renderToStream returns a string from res.renderVue to the client

Kind: instance method of Renderer

Param Type
vuefile string
data object
vueOptions object

VueOptions

{
    pagesPath: path.join(__dirname, '/../tests'),
    vueVersion: "2.3.4",
    template: {
        body: {
            start: '<body><div id="app">',
            end: '</div></body>'
        }
    },
    webpack: {
        /**
         * Webpack Server and Client Configs go here
         * Takes webpack configs and uses webpack-merge to merge them
         * */
        client: {},
        server: {}
    },
    vue: {
        /**
         * This is where you put the string versions of the
         * entry.js for server and client
         * app is for the app entry.js
         * */
        app: 'string',
        client: 'string',
        server: 'string',
    },
    head: {
        metas: [
            {
                property: 'og:title',
                content: 'Page Title'
            },
            {
                name: 'twitter:title',
                content: 'Page Title'
            },
            {
                name: 'viewport',
                content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'
            }
        ],
        scripts: [
            {src: 'https://unpkg.com/[email protected]/dist/vue.js'}
        ], 
        styles: [

        ]
    }
    data: {
        thing: true
    }

License

Apache-2.0 © Daniel Cherubini

vue-pronto's People

Contributors

danielcherubini avatar d0cm0d avatar greenkeeper[bot] avatar dacsang97 avatar 625dennis avatar nick-fytros avatar akhoury avatar upd4ting 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.