Skip to main content

vbuild

"Compile" your VUEJS component (*.vue) to standalone html/js/css ... python only (no need of nodejs). BTW it provides a js-minimizer (es2015 compliant code)

It's just an utility to extract HTML(template), SCRIPT and STYLE from a VUE/SFC component (*.vue). It's PURE python (py2 & py3 compatible), no nodejs ! It's fully unitested (100% !)

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

import vbuild

sfc=vbuild.VBuild("mycompo.vue")
print( sfc.html )
print( sfc.script )
print( sfc.style )

or

import vbuild

ll=[]
ll.append( vbuild.VBuild("c1.vue") )
ll.append( vbuild.VBuild("c2.vue") )

s=sum(ll)

print( s.html )
print( s.script )
print( s.style )

By default, VBuild won't minify things. But you can change that by using vbuild.VBuild("mycompo.vue", minify=True), but you'll need to install css-html-js-minify.

You can use sass (using <style lang="scss"></style> or <style lang="sass"></style>) or less (using <style lang="less"></style>) in your styles. But you'll need to install pyscss or lesscpy, depending on your needs.

By the way, the module provide a js-minimizer(transpiler) (to generate ES5 compliant js) (thru on the clojure online service)

js="""async function  mymethod(...a) {
    var f=(...a) => {let b=12}
}
"""
min=vbuild.minimize(js)

Notes:

  • templates are converted to a <script type="text/x-template" id="XXX"></script> (not converted to JS)
  • A Minimal component needs the <template></template> tag only (specs)
  • You can use <style></style> and/or <style scoped></style> (as many as you want)
  • styles are minimized (remove comments and spaces)

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 5 lines of python code; example:

import vbuild,glob
r=sum([vbuild.VBuild(i,minify=True) for i in glob.glob("*.vue")+glob.glob("*/*.vue")])
buf=readYourTemplate("index.tpl") # should contains a tag "<!-- HERE -->" that would be substituted
buf=buf.replace("<!-- HERE -->",str(r))
writeYourTemplate("index.html",buf)

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

Hope it could help ...

TODO:

  • more utilities
  • and docs !

Release files for vbuild 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vbuild 0.4.5
File Size Uploaded
vbuild-0.4.5.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vbuild 0.4.5
File Interpreter ABI Platform
vbuild-0.4.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.4 kB

Release files / vbuild-0.4.5.tar.gz

Download URL vbuild-0.4.5.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8214aff0e3434fcdc2e06d824fd8eac748efc5c88626815f325972aa87a0629c
BLAKE2b-256 checksum
How to use checksums
302bc6a49ec115aac43ec90b110e889aff07de9095d6d5ad2bbeeac4cd9e506a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / vbuild-0.4.5-py2.py3-none-any.whl

Download URL vbuild-0.4.5-py2.py3-none-any.whl
Size 5.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2584a813192aa46600be5a661a419b2bbb42215522674a6e272ebbfde171ac92
BLAKE2b-256 checksum
How to use checksums
a3950809756fd2da15ec7f6c3cae554631c53399897ee75b14466c4edde4ad12
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

This release

0.4.5 This release

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.3

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page