Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-jade-inheritance

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-jade-inheritance - npm Package Compare versions

Comparing version 0.0.4 to 0.5.0

2

package.json
{
"name": "gulp-jade-inheritance",
"version": "0.0.4",
"version": "0.5.0",
"description": "Rebuild only changed jade files and all it dependencies",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,2 +27,62 @@ #gulp-jade-inheritance

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.
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.
### Only process changed files
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.
```js
'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:
```shell
npm install gulp-jade-inheritance gulp-jade gulp-changed gulp-cached gulp-if gulp-filter --save-dev
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc