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](https://vuejs.org/) [component (*.vue)](https://fr.vuejs.org/v2/guide/single-file-components.html) 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 !
```python
import vbuild
sfc=vbuild.VBuild("mycompo.vue")
print( sfc.html )
print( sfc.script )
print( sfc.style )
```
or
```python
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 the way, the module provide a js-minimizer (to generate ES2015 compliant) (thru on the [clojure online service](https://closure-compiler.appspot.com))
```python
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
* It works with just one `<style></style>` tag !
* `Style` are SCOPED only (just style the component, you can't style others things)
* 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:
```python
import vbuild,glob
r=sum([vbuild.VBuild(i) for i in glob.glob("*.vue")+glob.glob("*/*.vue")))
buf=readYourTemplate("index.tpl") # should contains a tag "<!-- HERE -->" that would be substitued
buf=buf.replace("<!-- HERE -->",str(r))
writeYourTemplate("index.html",buf)
```
Hope it could help ...
"Compile" your [VUEJS](https://vuejs.org/) [component (*.vue)](https://fr.vuejs.org/v2/guide/single-file-components.html) 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 !
```python
import vbuild
sfc=vbuild.VBuild("mycompo.vue")
print( sfc.html )
print( sfc.script )
print( sfc.style )
```
or
```python
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 the way, the module provide a js-minimizer (to generate ES2015 compliant) (thru on the [clojure online service](https://closure-compiler.appspot.com))
```python
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
* It works with just one `<style></style>` tag !
* `Style` are SCOPED only (just style the component, you can't style others things)
* 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:
```python
import vbuild,glob
r=sum([vbuild.VBuild(i) for i in glob.glob("*.vue")+glob.glob("*/*.vue")))
buf=readYourTemplate("index.tpl") # should contains a tag "<!-- HERE -->" that would be substitued
buf=buf.replace("<!-- HERE -->",str(r))
writeYourTemplate("index.html",buf)
```
Hope it could help ...
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
vbuild-0.3.tar.gz
(3.9 kB
view details)
Built Distributions
vbuild-0.3-py3-none-any.whl
(4.0 kB
view details)
vbuild-0.3-py2-none-any.whl
(5.8 kB
view details)
File details
Details for the file vbuild-0.3.tar.gz
.
File metadata
- Download URL: vbuild-0.3.tar.gz
- Upload date:
- Size: 3.9 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 | 5b191376ebd5fd140c62f434eb35c343ab2fbd7d9c84094f6dc1640e3b60a2b5 |
|
MD5 | 0776f832651e36a96e284b8d964e790f |
|
BLAKE2b-256 | 8578727a0e3f5dd11f846c4071d5658ad42b350ad7c873b34074c4dd89e1aa43 |
File details
Details for the file vbuild-0.3-py3-none-any.whl
.
File metadata
- Download URL: vbuild-0.3-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: 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 | 1917d8ed3ee24e382248d359fb4be2492fc4da5da821476b05b8b45364a335cc |
|
MD5 | b29f7e670adee588ed2fdc8db7e98c43 |
|
BLAKE2b-256 | 26b409e937111fe66dbf51669f618d1b980138e9ca929174d86a87a9c2b0a669 |
File details
Details for the file vbuild-0.3-py2-none-any.whl
.
File metadata
- Download URL: vbuild-0.3-py2-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2
- 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 | 7f8a63f4b1b8f7cbfc08c272f9a9bbbb59a791b758d510d058a9a6e9ba964b48 |
|
MD5 | d4d90bd14f1bd216777daafc73ef9827 |
|
BLAKE2b-256 | 2613b39387f43f6611f14dd9b6c33aef14d272d9b20b6c1247e2fba4b8ad54d9 |