Skip to content

625dennis/vue-pronto

This branch is 1 commit ahead of, 23 commits behind express-vue/vue-pronto:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a65209e · Feb 27, 2020
Jan 28, 2019
Nov 6, 2017
Feb 27, 2020
Aug 29, 2019
Aug 6, 2019
Feb 17, 2018
Jan 22, 2019
Jan 29, 2019
Dec 20, 2017
Dec 20, 2017
Dec 20, 2017
Nov 6, 2017
Feb 1, 2019
Feb 9, 2018
Sep 2, 2019
Sep 2, 2019
Aug 5, 2019

Repository files navigation

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/vue@2.3.4/dist/vue.js'}
        ], 
        styles: [

        ]
    }
    data: {
        thing: true
    }

License

Apache-2.0 © Daniel Cherubini

About

Rendering Engine for turning Vue files into Javascript Objects

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 86.1%
  • HTML 7.3%
  • Vue 5.1%
  • Python 1.5%