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 with vbuild, in your vue/sfc files !!!
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.
Features
- NO node-js stack, only pure python (py2 or py3 compliant)
- Ability to use python components
- Components can be styled with SASS or LESS ccs-pre-processors !
- Provide a JS-minimizer (ES5 compliant JS, via closure)
- Ability to post process stuff, with your own processors
- Respect VueJs specs (at least one template tag, many style (scoped or not) tags)
templates
are converted to a<script type="text/x-template" id="XXX"></script>
(not converted to JS)- Unittested (coverage 100%)
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)
Vue/sfc component compatibility
All classical JS vue/sfc components are compatibles. But now, you can use python component too.
Here is, side by side, the same component (in js, and in python):
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
- more utilities
- more rock solid version
- and docs !
- add pyscss lesscpy closure to pip setup.py (optionnal's modules)
- see the TODO list for python components too
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vbuild-0.7.2.tar.gz
.
File metadata
- Download URL: vbuild-0.7.2.tar.gz
- Upload date:
- Size: 8.1 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4663ec13e124c35a3e6004791dcb1fe124230c3398a334e3047679c205c05e29 |
|
MD5 | 9f42537eaf11a664dd73ff64b5394cc7 |
|
BLAKE2b-256 | f422a943477cfe79d39df71e51e368a23cd8a778692d8f1e832cc0f259e91bc6 |
File details
Details for the file vbuild-0.7.2-py2.py3-none-any.whl
.
File metadata
- Download URL: vbuild-0.7.2-py2.py3-none-any.whl
- Upload date:
- Size: 8.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 285d20dd1e19ba6cbeae1bdc3f02870644d7064121483d4d715061a95772a2ce |
|
MD5 | a73aaff6380d1a09d8ae600adcf40015 |
|
BLAKE2b-256 | 3bbf455a1bafc3bc2e25341acea76a00f46b881b2cc3d2da30b37879bcdb4c8b |