C Brown

Results 12 comments of C Brown

I'll play around with this tonight. Sorry for the delay.

Try this... ``` gulp.task('json-test', function() { return gulp.src('./examples/test1.html') .pipe(data(function(file) { var path = './examples/' + path.basename(file.path) + '.json'; return (fs.existsSync(path)) ? require(path) : {}; })) .pipe(swig()) .pipe(gulp.dest('build')); }); ```

To be honest, the `opts.ext` option was put in very early before some gulp best practices. I was thinking of taking out that completely in favor of using `gulp-rename` for...

by best practices, I mean, plugins shouldn't bake-in things that other plugins are much better at doing... encouraging a more modular eco-system.

My bet is that you're not passing the path to global.json correctly. You can verify that by using `fs.realpath` to see if the path is correct. Something like `console.log(fs.realpathSync('src/data/global.json')` Other...

Have you looked into the `gulp-data` plugin? You could do something like: ``` /* Get data via JSON file, keyed on filename. */ var swig = require('gulp-swig'); var data =...

Can you give me an example or write a test showing that it breaks? That will help clarify what you're talking about. Thanks.

I've been struggling with the same issue. It always copies files relative to the folder where the image/asset/file was imported from. No amount of finagling with a combination of outputPath...

I saw that but that's not what I'm proposing. I've created a new plugin for setting the data object, for other plugins to consume. The passing in the options.data as...

That's fine and makes sense in the short term. I guess what I'm trying to accomplish is to convince gulp plugin authors to use a single api provided through gulp-data....