Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Doesn't respect concatOutput #10

Open
thomthom opened this issue Jun 21, 2016 · 4 comments
Open

Doesn't respect concatOutput #10

thomthom opened this issue Jun 21, 2016 · 4 comments

Comments

@thomthom
Copy link

I tried to use concatOutput and concatFileName to create a single concatenated output file. The temp folder will produce the file, but gulp-soynode will copy the individually compiled files.

I also tried to use gulp-concat on the stream but the just concatenated the source .soy files.

Is this not supported - or am I using it wrong?

@mairatma
Copy link
Collaborator

We don't support concatOutput yet. Using other gulp tools like gulp-concat should work though, but since the stream outputs both soy and soy.js files they'd all be concatenated together, which is probably not what you want. In this case, you could use gulp-if as well to concate just the files you want.

An example of usage:

var concat = require('gulp-concat');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var soynode = require('gulp-soynode');

gulp.task('soy', function() {
  return gulp.src(soySrc)
    .pipe(soynode())
    .pipe(gulpif('*.soy.js', concat('bundle.js')))
    .pipe(gulp.dest(soyDest));
});

Let me know if this worked for you.

@thomthom
Copy link
Author

Works like a charm! Thank you very much - once again.

I made use of gulp-ignore to exclude the soy files - as they where not desired in the final output.

var concat = require('gulp-concat');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var gulpignore = require('gulp-ignore');
var soynode = require('gulp-soynode');

gulp.task('soy', function() {
  return gulp.src(soySrc)
    .pipe(soynode())
    .pipe(gulpif('*.soy.js', concat('bundle.js')))
    .pipe(gulpignore.exclude('*.soy'))
    .pipe(gulp.dest(soyDest));
});

@mairatma
Copy link
Collaborator

Glad to know it worked!

I'll keep this open because it's still weird that we don't respect an option that soynode accepts. We can either start using it as well or warn explaining that concatenating should be done via gulp-concat.

@thomthom
Copy link
Author

Making use of soynode options would be nice - though, I'll take whatever works. :) If you end up going with a warning then adding your example to the README or wiki would probably go a long way to answer this.

I was surprised that the original .soy files where forwarded to the output - but then again, I'm rather new to npm,gulp so maybe that contribute to my confusion. Though that snippet above works great - single compiled JS file. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants