GithubHelp home page GithubHelp logo

sixertoy / gulp-mustacher Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 22 KB

Gulp task to help build HTML static pages. Perfect for templating eZPublish, Magento, Drupal... CMS models

License: MIT License

JavaScript 41.50% HTML 58.50%

gulp-mustacher's Introduction

gulp-mustacher

MIT License NPM version NPM downloads Build Status Coverage Status

Gulp task build over Mustacher module

Designed for fit my own needs to build HTML static pages. Perfect for templating eZPublish, Magento, Drupal... CMS models

It provide an easy way to include handlebar's partials files inside HTML template page with a minimal list of helpers like repeat (loop), or, and.

Exposed HTML/Handlebar's helpers

blocks helpers
inline helpers

Install

npm install gulp-mustacher --save-dev

Usage

gulpfile.js

var gulp = require('gulp'),
    path = require('path'),
    mustacher = require('gulp-mustacher');

gulp.task('default', function () {
    var options = {
        partials: {
            ext: '.hbs',
            src: 'src/html/partials'
        }
    };
    return gulp.src(path.join('src', '*.tpl'))
        .pipe(mustacher(options))
        .pipe(gulp.dest('build/html'));
});

src/html/index.tpl

<!DOCTYPE html>
<html lang="fr">

<head>
    ....
    <!-- include dist/css/bundle.css in a <link href="... -->
    {{$css 'css/bundle'}}
    <!--
    or include inline styles from a file
    {{$css 'dist/public/css/bundle' true}}
    -->
</head>

<body>

    <div id="before-body">
        ...
    </div>

    <!-- include src/html/partials/header.hbs -->
    {{$include 'header'}}

    <div id="main">
        <!-- include src/html/partials/contents/main.hbs -->
        {{$include 'contents/main'}}
    </div>

    <!-- include src/html/partials/footer.hbs -->
    {{$include 'footer'}}

    <div id="after-body">
        ...
    </div>

</body>

</html>
    

More Documentation & Examples

Take a look at mustacher module for a full documentation

Issues

not yet implemented

  • Lorem Ipsum

gulp-mustacher's People

Contributors

sixertoy avatar

Stargazers

 avatar Paul Leclercq avatar Angus H. avatar

Watchers

James Cloos avatar  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.