var config  = require('../config');

var gulp  = require('gulp');

var nunjucksRender  = require('gulp-nunjucks-render');
var browserSync = require('browser-sync');

var items = [
    {'name': 'Test', 'last_name': 'Test Last'},
    {'name': 'Test3', 'last_name': 'Test2 Last'}
]

gulp.task('templates:dev', function() {
    var browserSyncObj = browserSync.get('og');

    nunjucksRender.nunjucks.configure(['templates/'], {watch: true});
    return gulp.src(config.templates.src)
        .pipe(nunjucksRender({
            path: config.templates.path,
            data: {
                'items': items
            }
        }))
        .pipe(gulp.dest(config.templates.dest))
        .pipe(browserSyncObj.stream());
});
