M
M
mgfck2018-02-21 17:32:03
gulp.js
mgfck, 2018-02-21 17:32:03

How to config gulp to compile .vue (single-file components with styles) in dist?

Hello.
I need a config for gulp, after which the output was 2 files: out.css and out.js
.vue files (Single File Components) are input.
If possible, tell me how to do it right or where to dig, I already broke my whole head.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mgfck, 2018-02-26
@mgfck

After a long and hard search, I found what I needed:

gulp.task('dev', function() {
  return browserify({ entries: ['src/app/main.js']})
    //.transform(babelify, { presets: ['es2015'] })
    .transform(vueify)
    .plugin('vueify/plugins/extract-css', { out: './bundle.css' })    
    .bundle()
      .pipe(source('main.js'))
      .pipe(gulp.dest('./dist'))
      //.pipe(connect.reload());
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question