Package deprecated
emitty. It's easier and more convenient.
Please, useyellfy-pug-inheritance
Determine the inheritance of Pug (ex. Jade) templates.
Install
$ npm i -D yellfy-pug-inheritance
Why?
Because existing solutions use redundant modules such as Pug parser and Glob.
Usage
const pugInheritance = ; pugInheritance;
API
updateTree(dir, [options]) → result
Options
changedFile
- Type:
String
- Default:
''
The name of the file that has been changed since the last build tree.
treeCache
- Type:
ITreeStorage
→{ [filename: string]: string[] }
- Default:
{}
The previous tree of dependencies that will be used as cache.
jade
- Type:
Boolean
- Default:
false
Working with Jade files.
Result
tree
- Return:
ITreeStorage
→{ [filename: string]: string[] }
Returns the dependency tree for all files.
getDependencies(filename)
- Return:
string[]
Returns an array of dependencies for specified file.
checkDependency(filename, filenameToCheck)
- Return:
boolean
Returns true if the specified file is in the dependencies of the specified file.
Gulp example
// npm i gulpjs/gulp#4.0 gulp-if gulp-filter yellfy-pug-inheritance gulp-pugconst gulp = ;const gulpif = ;const filter = ;const pugInheritance = ;const pug = ; // Cachelet pugInheritanceCache = {}; // Root directory that contains your Pug filesconst pugDirectory = 'app/templates'; // Watch taskgulp; // Filter for files { const filepath = `/`; if inheritance console; return true; return false;} // Templates taskgulp;
Changelog
See the Releases section of our GitHub project for changelogs for each release version.
License
This software is released under the terms of the MIT license.