Code Monkey home page Code Monkey logo

gulp-jade-globbing's Introduction

This package has been deprecated & archived

Jade is considered deprecated. Use Pug instead. See the official Pug migration guide: https://pugjs.org/api/migration-v2.html#project-rename

gulp-jade-globbing

Globbing with Jade the easy way.

Expands Jade include and extends statements to allow globbing and placeholders.

Based on gulp-css-globbing.

Install

Install gulp-jade-globbing as a development dependency using npm:

npm install --save-dev gulp-jade-globbing

Usage without options

gulpfile

var jade          = require('gulp-jade');
var jadeGlobbing  = require('gulp-jade-globbing');

gulp.task('jade', function(){
  gulp.src(['src/index.jade'])
    .pipe(jadeGlobbing())
    .pipe(jade())
    .pipe(gulp.dest('build'));
});

src/index.jade

//- ...
include ../foo/bar/**/*.jade
//- ...

Advanced example

gulp task

gulp.task('jade', function(){
  gulp.src(['src/views/**/*.jade'])
    .pipe(jadeGlobbing({
      placeholder: {
        'modules': 'src/modules/**/*.jade',
        'layout': 'src/layout/**/*',
        'default-template': 'src/layout/templates/default.jade',
      }
      ignore: [
        'src/views',
        'src/layout/templates'
      ]
    }))
    .pipe(jade())
    .pipe(gulp.dest('build'));
});

page

extends {default-template}

block includes
  include ../../utilities/**/*.jade
  include ../../base/*.jade
  include {modules}
  include {layout}

block container
  h1 Hello World!

template to extend

block includes
doctype html
html
  head
    meta(charset='utf-8')
    title Hello?

  body
    block container

Options

gulp-jade-globbing can be called with an options object:

gulp.task('jade', function(){
  gulp.src(['src/index.jade'])
    .pipe(jadeGlobbing({
      placeholder: {
        'base': 'src/jade/base/*.jade',
        'modules': 'src/jade/modules/**/*.jade',
        'layout': 'src/jade/layout/**/*',
        'default-template': 'src/jade/layout/templates/default.jade',
      }
      ignore: ['src/jade/layout/templates']
    }))
    .pipe(jade())
    .pipe(gulp.dest('build'));
});

ignore

Type: String or Array

Folders gulp-jade-globbing should ignore.

Default: []

placeholder

Type: Object

Placeholders to use within jade files, e.g. {modules}.

Default: {}

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.