Giter Club home page Giter Club logo

gulp-jade-recursive's Introduction

gulp-jade-recursive

Easing incremental builds with Gulp and Jade by keeping track of a dependency tree (include/extend statements) and kicking off a rebuild for every file that is affected by the changed file.

Usage

npm install gulp-jade-recursive

Why create this plugin? Because gulp-jade-find-affected didn't work for me.

gulpfile.js for incremental multi-lang static pages

var gulp = require('gulp');
var watch = require('gulp-watch');
var data = require('gulp-data');
var jade = require('gulp-jade');
var recursive = require('gulp-jade-recursive');
var foreach = require('gulp-foreach');
var merge = require('merge-stream');
var filter = require('gulp-filter');

function tpl(lang, tube) {
  return tube
  // Return data to be available in Jade-templates
  .pipe(data(function(file) {
    return {
       var: "value",
    };
  }))
  .pipe(jade())
  .pipe(gulp.dest('build/'+lang+"/"));
}

gulp.task('default', [], function() {
  // Watch all Jade-files for changes
  return watch('src/static/**/*.jade')
  // Let this plugin maintain a map and return all affected files
  .pipe(recursive('src/static/**/*.jade'))
  // Only build the pages
  .pipe(filter('src/static/pages/**/*.jade'))
  // We want NL(Dutch) and EN(English) so use foreach to trigger both
  .pipe(foreach(function(stream, file) {
     // Build single file to multi-lang
     return merge(
       tpl('nl', gulp.src(file.path)),
       tpl('en', gulp.src(file.path))
     );
   }));
});

TODO

  • New include/extend statements do not update the map yet.

gulp-jade-recursive's People

Contributors

mpdroog avatar

Watchers

Wolfr avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.