how to render file vue template in javascript with gulp

Solutions on MaxInterview for how to render file vue template in javascript with gulp by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to render file vue template in javascript with gulp"
Niklas
24 Jul 2018
1gulp.task('bundle-for-dev', function () {
2    return browserify({entries: ['./src/js/entry.js']}) // path to your entry file here
3    .transform(vueify)
4    .plugin('vueify/plugins/extract-css', { out: './tmp/css/bundle.css' }) // path to where you want your css
5    .transform(babelify, {"presets": ["es2015"]})
6    .external('vue') // remove vue from the bundle, if you omit this line whole vue will be bundled with your code
7    .bundle()
8    .pipe(source('bundle.js'))
9    .pipe(gulp.dest('./tmp/js'));
10})
11
Noah
18 Apr 2018
1gulp.task('bundle-for-prod', function () {
2    return browserify({entries: ['./src/js/entry.js']}) // path to your entry file here
3    .transform(vueify)
4    .plugin('vueify/plugins/extract-css', { out: './dist/css/bundle.css' }) // path to where you want your css
5    .transform(babelify, {"presets": ["es2015"]})
6    .transform(uglifyify, {global: true}) // of course if you want to use this transform
7    .external('vue') // remove vue from the bundle, if you omit this line whole vue will be bundled with your code
8    .bundle()
9    .pipe(source('bundle.js'))
10    .pipe(buffer()) // you have to use it if you want to use more pipes
11    .pipe(uglify()) // This is different from uglifyify transform. I am using both
12    .pipe(gulp.dest('./dist/js'));
13})
14
Enzo
25 Apr 2016
1"browser": {
2   "vue": "vue/dist/vue.common.js"
3 }
4
Monica
24 Apr 2020
1var babelify   = require('babelify'),
2    browserify = require('browserify'),
3    buffer     = require('vinyl-buffer'),
4    es         = require('event-stream'),
5    gulp       = require('gulp'),
6    source     = require('vinyl-source-stream'),
7    uglify     = require('gulp-uglify'),
8    uglifyify  = require('uglifyify'),
9    vueify     = require('vueify');
10