Giter Site home page Giter Site logo

assemble-handlebars's Introduction

assemble-handlebars NPM version NPM monthly downloads NPM total downloads Linux Build Status Windows Build Status

Handlebars engine plugin for grunt-assemble. This is only used in grunt-assemble and versions of assemble below 0.4.x.

Install

Install with npm:

$ npm install --save assemble-handlebars

Usage

var assembleHandlebars = require('assemble-handlebars');

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
70 doowb
26 jonschlinkert
6 LaurentGoderre
2 adjohnson916
1 spacedawwwg

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Brian Woodward

License

Copyright © 2017, Brian Woodward. Released under the MIT License.


This file was generated by verb-generate-readme, v0.4.3, on March 17, 2017.

assemble-handlebars's People

Contributors

doowb avatar jonschlinkert avatar laurentgoderre avatar spacedawwwg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

assemble-handlebars's Issues

after update from v0.2.3 to v0.2.5, #compose not rendering {{{@conent}}}?

I was able to render multiple partials to a single page using handlebars-helper-compose prior to [email protected].

E.g. this worked fine in my page.hbs, where src/templates/partials had multiple .hbs partials:
{{#compose cwd="src/templates/partials" src="*.hbs"}}
{{{@content}}}
{{/compose}}

I can still render the multiple partials if I revert the sub package for assemble to [email protected] (in my-project-folder/node_modules/assemble/node_modules/assemble-handlebars

@title, @basename, @filename etc all seem to work still.
I can even log out the @content markup {{log @content}}, but when trying to render it, no markup is injected.

I have deleted my main node_modules folder and reinstalled all modules (npm install), but that didn't seem to help.

Version info:
{{{@content}}} works with:
[email protected], [email protected] and [email protected].
Not working as expected (for me) with:
[email protected], [email protected] and [email protected].
Node: v0.10.20

Is there a slightly different way of using the compose helper since the latest update to assemble-handlebars?

Or, if you can't reproduce, could you offer suggestions?

(apologies if this should be logged on the handlebars-helper-compose project, but there didn't seem to be any changes to that code base recently)

Thanks

Using the {{embed}} helper wont pull any content

Im trying to pull html to my page, using something like:
{{embed './forms/verticalforms.html'}}

However after trying many paths, no matter which starting point I used on the include I cant get the output to include the html of the embedded file. I think this means it isn't getting into the file but im not understanding why.

Can you help?

Scope issue in if helper after updating to handlebars >= 4.0.0

After i updated to the newest version of handlebars the scope in if blocks did not work the same.

{{#each users }}
    {{#if this.person }}
        {{ ../../users.length }} // <= 4.0.0
        {{ ../users.length }} // >= 4.0.0
    {{/if}}
{{/each}}

Do you have any plans to update handlebars?

Blockquotes not rendering

Hi,

I am having a problem getting blockquotes to render correctly. The following code illustrates the problem, when I run it the output is:

<h1 id="heading">heading</h1>
<p> &gt; pull quote</p>

i.e. the > is being escaped rather than rendered as a blockquote.

Any help greatly appreciated,

David

var assemble = require('assemble-handlebars');
assemble.init({
    marked: { sanitize: false, gfm: true}
});
var templateSrc =  '{{#markdown}}{{body}}{{/markdown}} ';
var doc = { body: "#heading\n\n > pull quote" };

assemble.compile(templateSrc, {}, 
    function(ex, template) {        
        assemble.render(template, doc, function(ex, renderedContent) {
                console.log(renderedContent);   
            });
    });

Can't pass hash of named parameters in v2.5 or 3.0

The construct:
{{> carousel-8 onestore=../onestore}}

worked fine in 0.2.4, and seems to have regressed in 0.2.5 and 0.3.0 reporting an error at the = character, saying Parse Error. Expecting 'CLOSE', 'CLOSE_UNESCAPED'......

According to @wycats, this can be tested via this case and this case as well.

Upgrade to Handlebars 3.0.x is breaking change

between 0.2.3 and 0.2.5, the version of handlebars used in assemble-handlerbars went from ~1.3.0 to ^3.0.1. Since assemble-handlers is a fairly thin wrapper around handlebars specifically for connection to assemble (which version 0.4.42 includes assemble-handlebars at version ^0.2.3), the change in handlebars versions (a significant change, which by the guidelines of semvar can include breaking changes) is automatically picked up when [email protected] is included.

In this particular case, I have found where handlebars does not seem to handle a particular case in the same way as earlier versions did. I have confirmed that none of the code above handlebars has changed.

Essentially, I have several markdown files whose layout is specified by the assemble config. In each of these files, I have YAML front matter with a property called data, which is pulled from a .json data file using loDash templates.

Example (for "foo.md")

---
data: <%= reference.foo %>

---
...Some content here ....

In the case that foo is not a property defined in reference (different than undefined), it now errors in a very unclear manner ("Cannot call method 'replace' of undefined Use --force to continue") whereas under Handlebars 1.3.x, it did not (and everything successfully built).

{{@index}} inside {{#each}} messes with {{data}}

In my project, I have a .hbs similar to the following:

<div>
    <div id="description">
        {{data.description}}
    </div>
    <div id="operations">
        {{#each (getOperations page.basename)}}
             {{@index}}: {{this}}
        {{/each}}
    </div>
</div>

(This is somewhat simplified)

If the {{@index}} is included, then {{data.description}} (or anything else depending on data) doesn't render (because data seems to now hold a value if "true"). It seems to be related to how the index, etc are passed along in the each helper (in that, if I prevent that from actually occurring, everything works as it should).

I'm filing this here as opposed to with handlebars directly because the issue does not occur when I set up something like this in their jsFiddle template.

Web components with Component and Assemble

Background

In this issue: assemble/assemble#524, the use of Assemble for a sort of webcomponents briefly arose. I'm now experimenting here with whether html, css, js components could be managed with component whilst compiling the html templates with Assemble (since the #extend, #block and #content helpers allow for a way of defining separate components).

Issue: Component cannot compile assemble style hbs templates natively

As far as I know component cannot compile assemble style .hbs templates natively (the compilation of css and js works just fine). So I have to choose which way to go. The options I can see are:

  1. Not use html components at all (and just include a html style guide with every css/js component). Which would mean more manual maintenance.
  2. Skip building the templates when using component build and build them with Assemble instead.
  3. Use a builder plugin for component to allow it to compile the (Assemble) handlebars templates.

Option 3 would make the most sense to me but is also the most ambitious. It would make sense because the hierarchy of the different components could be handled by component, which is what it does best. Option 2 would not allow for that and would be a bit more bulky.

@jonschlinkert mentioned aiming for a way to use web components, and going for a more decoupled approach. Which direction would you take this experiment given the upcoming changes to Assemble? Would option 3 even be possible with the way Assemble is structured? I'm interested in what you (the creators of Assemble) have to say about this approach and whether it fits your intended use case for Assemble.


I hope that this isn't too vague of an issue. It is more a question about architecture concerning the use of Assemble, and I apologise if this isn't the right place for it. I know that the issue also concerns component, but I felt the main issue was with assemble. I would really appreciate any discussion on the subject!

Register Helpers missing from the Handlebars object. v2.4

Error loading helpers from file: ~/bower_components/{helper}.js
TypeError: Object # has no method 'registerHelper'

So I logged the object to see what was there, and there is not registerHelper on the object.

{
init: [Function],
compile: [Function],
render: [Function],
registerFunctions: [Function],
registerPartial: [Function]
}

Update handlebar-helpers

handlebars-helpers current version is using an old version for minimatch, could you please update handlebars-helpers to version 0.7.3 ?

some helpers throw error

When I use handlebars-helper-repeat with assemble v0.4.42, though the helper is installed, following error occures.

Warning: Missing helper: 'repeat' Use --force to continue.

Same error occured with handlebars-helper-eachItems.

Is this a problem with assemble-handlebars?

Add handlebars-helpers back in

I screwed up and didn't check my branches when merging. I removed handlebars-helpers from the dependency list and I need to add it back in.

Handlebars 2.0

Are there plans to update to handlebars 2.0? It would be nice to have access to the new partials with support for parameters:

{{> dude otherDude=name}}

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.