A simple cli for transforming .vue to .js
Prerequisites: Node.js (>=6.x, 6.x preferred).
$ npm install -g vue-to-js
Usage: vuetojs [options]
Options:
-h, --help output usage information
-V, --version output the version number
-r, --resource [path] .vue file
-d, --dest [path] output directory
-m, --mode [type] output mode, one of amd/umd/global/commonjs
Example:
$ vuetojs -r src/*.vue -d output -m amd
vue-to-js
can also be used as a nodejs lib. Look at the example below for more information.
var vuetojs = require('vue-to-js');
var path = require('path');
var code = vuetojs.generateCode(path.resolve(__dirname, 'src/index.vue'), 'amd');
console.log(code);
vuetojs.compile({
resource: 'src/*.vue',
dest: 'dest',
mode: 'amd'
});
get all blocks code from .vue
file
Param | Type | Description |
---|---|---|
path | string |
path of .vue file |
generate js code with appointed mode from single .vue
file
Param | Type | Description |
---|---|---|
path | string |
path of .vue file |
mode | string |
output mode, one of amd/umd/global/commonjs |
compile .vue
file to .js
file
Param | Type | Description |
---|---|---|
options | Object |
compile options |
options.resource | string |
path of .vue file, glob pattern |
options.dest | string |
directory of the compiled js files |
options.mode | string |
output mode, one of amd/umd/global/commonjs |
- beautify output js
- support source map
- support template engine
- support css preprocessor