M
M
myskypesla2017-03-25 10:54:16
gulp.js
myskypesla, 2017-03-25 10:54:16

How to make friends gulp + browserify (babelify, vueify)?

Tell me a task for processing gulp'om js (example below) that processes a project written in vue?
All sorts of errors constantly crash, apparently I can’t write the task correctly for browserify.
Here is an example of code to be rendered with browserify, babelify, vueify:

import Vue from 'vue'
import VueRouter from 'vue-router'

import About from '../vue/components/about.vue'
import Contacts from '../vue/components/contacts.vue'
import Projects from '../vue/components/projects.vue'

Vue.use(VueRouter)

var router = new VueRouter({
  routes: [
    {
      path: '/about',
      component: About
    },
    {
      path: '/contacts',
      component: Contacts
    },
    {
      path: '/projects',
      component: Projects
    }
  ]
})

new Vue({
    el: '#app',
    router: router
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
myskypesla, 2017-03-26
@myskypesla

Correct task for gulp:

gulp.task('js', function() {
  return browserify({ entries: 'src/js/main.js'})
    .transform(babelify, { presets: ['es2015'] })
    .transform(vueify)
    .bundle()
      .pipe(source('app.js'))
      .pipe(gulp.dest('public/js'))
      .pipe(connect.reload());
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question