Giter Site home page Giter Site logo

gulp-emblem's Introduction

gulp-emblem NPM version Build status

Emblem.js plugin for gulp ...a concise, beautiful, and fully compatible templating alternative for Handlebars.js.

Usage

First, install gulp-emblem and gulp-define-module as development dependencies:

npm install --save-dev gulp-emblem gulp-define-module

Then, add it to your gulpfile.js:

var emblem = require('gulp-emblem');
var defineModule = require('gulp-define-module');

gulp.task('templates', function(){
  gulp.src(['client/templates/*.em'])
    .pipe(emblem())
    .pipe(defineModule('node'))
    .pipe(gulp.dest('build/templates/'));
});

gulp-emblem outputs a raw handlebars function, so it is likely that you will want to use gulp-define-module to make the handlebars template available via a specific namespace or for use with a module system. For additional usage examples, we recommend that you visit gulp-handlebars and gulp-define-module.

Compiling to various module systems

gulp-define-module can be used to prepare the output for use with common module systems such as AMD, Node, and CommonJS. Please see the documentation for more details on how to use that in a gulp chain.

gulp-emblem makes the following available for use in the define-module wrapper:

  • handlebars: The handlebars template fully wrapped (Handlebars.template(<%= contents %>)).

API

emblem(options)

options.compilerOptions

Type: Object

Compiler options to pass to Emblem.precompile().

Attributions

This project is a fork of gulp-handlebars by lazd. Emblem.js is a concise, beautiful, and fully compatible templating alternative for Handlebars.js.

gulp-emblem's People

Contributors

buschtoens avatar lazd avatar wbyoung avatar greenkeeper[bot] avatar

Stargazers

Sanjay Kumari avatar Anton Romanov avatar Brian avatar Ian Walter avatar Pavel B. avatar Raine Revere avatar Daniel Fagnan avatar  avatar Smooth Operator avatar  avatar

Watchers

 avatar  avatar James Cloos avatar Josh Callender avatar  avatar

Forkers

saponifi3d rmnv

gulp-emblem's Issues

Compiling templates for ember use

How do you convert emblem handlebar templates for emberjs use? I'm assuming I have to use the ember-template-compiler, but I'm not sure how. Would I pass it in as an option in emblem({}) so it uses it during compilation/precompilation?

I currently have:

gulp.task('templates', function(){
    gulp.src('/templates/*.em')
        .pipe( emblem() )
        .pipe( defineModule('plain', {
                wrapper: 'Ember.Handlebars.template(<%= contents %>)'
        }) )
        .pipe( declare({
            namespace: 'Ember.TEMPLATES',
            noRedeclare: true
        }) )
        .pipe( concat('templates.js'))
        .pipe( gulp.dest('/templates/dist') )
)}

This gives me basic handlebars templates, but incorporating ember features such as == outlet throws errors.

Update the dependency tree

There are multiple dependencies that are running out of date - I tried upgrading it an kept getting merge is undefined - looks like event-stream isn't working quite right on the latest maybe?

I will keep working on a branch and open a PR if you don't have a chance.

Emblem to raw HBS, not a function wrapper

Hi,

How could I receive raw hbs (or event html) instead of getting wrapped js?

gulp.task( 'taskName', function() {
        return gulp.src( 'template.emblem')
                .pipe( emblem())
                .pipe( gulp.dest( '../build/'));
});

Do want:

<div>
 <label></label>
 {{#each}}
           <!-- blah-blah -->
{{/each}}
</div>

Instead of:

this["templates"] = this["templates"] || {};this["templates"]["taskName"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  var buffer = "", stack1, self=this; 

// blah-blah-blah... tones of code

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.