
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
gulp-jade-inheritance
Advanced tools
Rebuild a jade file with other files that have extended or included those file
Inspired by jade-inheritance
npm install gulp-jade-inheritance --save-dev
gulpfile.js
var jadeInheritance = require('gulp-jade-inheritance');
var jade = require('gulp-jade');
gulp.task('jade-inheritance', function() {
gulp.src('/jade/example.jade')
.pipe(jadeInheritance({basedir: '/jade/'}))
.pipe(jade());
});
In this example jade compile example.jade
and all other files that have been extended or included example.jade
. The plugin searches for those dependencies in the basedir
directory.
You can use gulp-jade-inheritance
with gulp-changed
and gulp-cached
to only process the files that have changed. This also prevent partials from being processed separately by marking them with an underscore before their name.
'use strict';
var gulp = require('gulp');
var jadeInheritance = require('gulp-jade-inheritance');
var jade = require('gulp-jade');
var changed = require('gulp-changed');
var cached = require('gulp-cached');
var gulpif = require('gulp-if');
var filter = require('gulp-filter');
gulp.task('jade', function() {
return gulp.src('app/**/*.jade')
//only pass unchanged *main* files and *all* the partials
.pipe(changed('dist', {extension: '.html'}))
//filter out unchanged partials, but it only works when watching
.pipe(gulpif(global.isWatching, cached('jade')))
//find files that depend on the files that have changed
.pipe(jadeInheritance({basedir: 'app'}))
//filter out partials (folders and files starting with "_" )
.pipe(filter(function (file) {
return !/\/_/.test(file.path) && !/^_/.test(file.relative);
}))
//process jade templates
.pipe(jade())
//save all the files
.pipe(gulp.dest('dist'));
});
gulp.task('setWatch', function() {
global.isWatching = true;
});
gulp.task('watch', ['setWatch', 'jade'], function() {
//your watch functions...
});
If you want to prevent partials from being processed, mark them with an underscore before their name or their parent folder's name. Example structure:
/app/index.jade
/app/_header.jade
/app/_partials/article.jade
/dist/
To install all that's need for it:
npm install gulp-jade-inheritance gulp-jade gulp-changed gulp-cached gulp-if gulp-filter --save-dev
FAQs
Rebuild only changed jade files and all it dependencies
The npm package gulp-jade-inheritance receives a total of 102 weekly downloads. As such, gulp-jade-inheritance popularity was classified as not popular.
We found that gulp-jade-inheritance demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.