Skip to main content

A simple module to extract html/script/style from a vuejs '.vue' file (can minimize/es2015 compliant js) ... just py2 or py3, NO nodejs !

Project description

vbuild

"Compile" your VueJS components (*.vue) to standalone html/js/css ... python only, no need of nodejs. And you can use python components in vbuild, in your vue/sfc !!!

It's just an utility to extract HTML(template), SCRIPT and STYLE from a VUE/SFC component (*.vue). It won't replace webpack/nodejs/vue-cli, it fills the "Sometimes you have to work with the tools you have, not the ones you want." gap.

Available on pypi

Features

import vbuild

c=vbuild.render("mycompo.vue")
#c=vbuild.render("vues/*.vue")
#c=vbuild.render( "c1.vue", "c2.vue" )
#c=vbuild.render( "c1.vue", "vues/*.vue" )

print( c.html )
print( c.script )
print( c.style )

#or 

print( c ) # all stuff in html tags

Main Goal

Its main purpose is to let you use components (.vue files) in your vuejs app, without a full nodejs stack. It's up to you to create your generator, to extract the things, and create your "index.html" file. It's a 4 lines of python code; example:

import vbuild
buf=readYourTemplate("index.tpl") # should contains a tag "<!-- HERE -->" that would be substituted
buf=buf.replace("<!-- HERE -->",str( vbuild.render( "vues/*.vue" ) ) )
writeYourTemplate("index.html",buf)

(a real example of rendering vue/sfc components, using vbuild and the marvelous wuy)

A python component

Here is a simple example : a "named counter" (with a button to add +1 to the counter):

<template>
    <div>
        {{name}} : {{cpt}} <button @click="inc()">+1</button>
    </div>
</template>
<script lang="python">

class Component:
    def __init__(self, name):   # name is a props !
        self.cpt=0
    def inc(self):
        self.cpt+=1

</script>
<style scoped>
:scope {background:yellow}
</style>

If this file is named cpt.vue ; you can use it with <cpt name="c"></cpt>.

To use the full features of vbuild

If you want to use the full features, you'll need to install the optionnal's libs.

sudo pip install pyscss lesscpy closure

All theses libs works with py2 and/or py3, and you could use the ccs-pre-processors SASS and LESS, and closure to minify js.

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vbuild-0.6.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

vbuild-0.6.0-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file vbuild-0.6.0.tar.gz.

File metadata

  • Download URL: vbuild-0.6.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for vbuild-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d321b3e3f734f9955e14dcc61761497758b0e9baea127640ffefcf90eac20f79
MD5 0a429e31cfb5830f80b3146b90132321
BLAKE2b-256 7e7abe618004f50bdf595dad3239ec50e7c7425ab33dc49c09b9feefaf3acf8a

See more details on using hashes here.

File details

Details for the file vbuild-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: vbuild-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for vbuild-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c36447783f4f08ecbb8ab12eb0d38ddbb6d9dd5ed35e8801b9d99efccd2feef4
MD5 da5d3a85559909d52a1673b96b31fd9d
BLAKE2b-256 8ee82746d59002fc7e0233e4d54aedb89f4d46b8f4cae4bb48027380e1c30527

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page