Git Product home page Git Product logo

grunt-hogan's People

Contributors

dave-elkan avatar eirslett avatar el2iot2 avatar pscheit avatar wilsonpage avatar

Stargazers

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

Watchers

 avatar

grunt-hogan's Issues

Remove "Render" directive

Since any executing javascript code can "render" the result of a grunt-hogan compile, it isn't very useful to provide a render directive. It complicates the configuration and is a source of confusion.

Note: this will incur breaking changes for existing configurations

nodejs : {
            compile : {
                templates : "view/binder/nodejs.hogan",
                output : "tasks/binder/nodejs.js",
                options : {
                    binderName: "bootstrap",
                }
            }
        },

Should now be:

nodejs : {
                templates : "view/binder/nodejs.hogan",
                output : "tasks/binder/nodejs.js",
                binderName: "bootstrap"
        },

Hogan.js to standalone vanilla js?

Is it possible to have hogan compile the templates into a state where the need for hogan.js is not required? Just curious if there's an option to do that that I missed.

Custom Binder Templates are not functional

As indicated from further investigation of issue #6 , The Custom Binder Template support was intended, but not really tested or functional.

Fix it and update the documentation.

Cannot use partials with amd binder output

I have just tried to switch to using the amd binder for compiling our templates, but I have found I am unable to use partials with the current output.

The problem as I see it is that the hogan.js library expects the templates to of type Hogan.Template, but the amd compiled template output cannot provide this as it only returns a function, which when called renders the template.

A mock example of how I am using this is:

<div class="viewport">
    <div class="actions">
        {{>actions}}
    </div>
    <div class="meta">
        {{>meta}}
    </div>
</div>

And I am rendering the template like this:

templates.viewport(data, {
         actions: templates.actions,
         meta: templates.meta
});

I have also tried passing the partials in rendered but this also doesn't work:

templates.viewport(data, {
         actions: templates.actions(),
         meta: templates.meta()
});

The problem comes down to the output only providing access to rendered templates. The simplest solution would be just to return the Hogan.Template. This does mean you need to call render(), but this is the same as the output from the hulk binder.

Here is what works for me.

define(['hogan'], function(Hogan) {
  var t = {
    {{#templates}}
    "{{name}}" : new Hogan.Template({{{template}}}){{comma}}
    {{/templates}}
  },
  r = function(n) {
    return t[n];
  };
  return {
    {{#templates}}
    "{{name}}" : r('{{name}}'){{comma}}
    {{/templates}}
  }
});

About exportName

I wanna use some export name like _aaa.bbb.ccc, but this won't work now.
Because exportName = this.target and target named _aaa.bbb.ccc won't run in grunt task.
Maybe there's a good way to resolve this problem: add a option called namespace and use this as exportName.

If you think it's OK, i'm glad to send PR to do this.

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

unable to write compiled template to file

admittly I am new to hogan.js, but for some unknown reason I keep getting this error, which i don't think is hogan.js related.

Compiling template...
Requiring binder template...
>> Found templates["default"]
template/welcome.mustache -> welcome
Reading template/welcome.mustache...OK
Writing dev/asset/template/welcome.js...ERROR
>> Error: Unable to write "dev/asset/template/welcome.js" file (Error code: undefined).
>> Failed to write out compiled template:
>> dev/asset/template/welcome.js

there is no weird permission on folder dev/asset/template, and other grunt task is perfectly able to write to it, I am using the minimal example with src and dest, not sure what went wrong.

Add to grunt-contrib

You should look to submit this for inclusion in the grunt-contrib project. Will require that you make some adjustments to meet their submission criteria.

Loading yields error: Unexpected token

node_modules/grunt-hogan/tasks/binders.js:5
es["hulk"] = new Hogan.Template(function(c,p,i){var =this;.b(i=i||"&quo
^
Loading "binders.js" tasks and helpers...ERROR

SyntaxError: Unexpected token &

It seems to be broken at &quot&quot

Custom binders...

I can't get custom binders to work, and there isn't much info on them. Where should I start debugging?

Gruntfile:

hogan: {
customBinder: {
template : './templates/binders/pvcBinder.hogan',
output : './templates/binders/pvcBinder.js',
binderName: 'bootstrap'
},
compileTemplates : {
template : './templates/views/*.hogan',
output : './assets/js/hogan-templates.js',
binder: __dirname + '/templates/binders/pvcBinder.js',
}
}

watch: {
hogan: {
files: ['./templates/views/*.hogan'], //watched files
tasks: ['hogan:customBinder', 'hogan:compileTemplates', 'concat:js_frontend','uglify:frontend']
}
}

pvcBinder.hogan: (As a test I simply included the contents of hulk.hogan)

{{!the hulk binder tries to emulate the output of the hulk cli in hogan.js}}
var templates = {};
{{#templates}}
templates['{{name}}'] = new Hogan.Template({{{template}}});
{{/templates}}

Results in an empty hogan-templates.js file... (The binder itself compiles, but the templates aren't compiled by the custom binder...)

Custom binder

What is a correct way to include my custom binder? (I have already created custom-binder.js and custom-binder.hogan)

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.