Skip to content
This repository has been archived by the owner on May 20, 2018. It is now read-only.

Add render task #114

Closed
wants to merge 1 commit into from
Closed

Add render task #114

wants to merge 1 commit into from

Conversation

floydwch
Copy link
Contributor

Add render task to support render underscore template.

@ctalkington
Copy link
Member

hum, if i understand this, its basically jst task with an additional output?

@floydwch
Copy link
Contributor Author

@ctalkington It's more general for render underscore template, jst is specific to jst, but render does't specific to any form.

I use it to render angular-underscore's submodule

here is some snippet:

define(['angularjs', './_'], function(ng, _) {
  'use strict';

  var module = ng.module('angular-underscore/filters/<filterName>', []);
  var filter = _.bind(_.<filterName>, _);
  var filterFactory = function() {return filter;};

  module.filter('<filterName>', filterFactory);

  return module;
});

feed {data: {filterName: "map"}} to grunt render =>
the output:

define(['angularjs', './_'], function(ng, _) {
  'use strict';

  var module = ng.module('angular-underscore/filters/map', []);
  var filter = _.bind(_.map, _);
  var filterFactory = function() {return filter;};

  module.filter('map', filterFactory);

  return module;
});

If I understand jst correctly, jst cannot does such compile, so I create render.

@ctalkington
Copy link
Member

this makes the second underscore related pull. I think we are going to need to rethink how underscore is used. thinking about having an actual underscore task that can do:

underscore -> precompiled jst (existing)
underscore -> _.template (see #98)
underscore -> compiled output (like this if i understand)

@ctalkington ctalkington mentioned this pull request Aug 29, 2012
Closed
@ctalkington
Copy link
Member

@floydsoft give me a week or so to talk over some ideas with @tkellen. i think we could go a few routes while keeping a multi-function task to handle some variations.

@floydwch
Copy link
Contributor Author

IMO, underscore is not a specific concept to be a task, if we have underscore task with more control options, isn't it crowded in the config?

@ctalkington
Copy link
Member

i have a few ideas going. being that all these things require underscore so I want to contain them in a single "task" file with a single helper and aliases.

@ctalkington
Copy link
Member

another issue i have with render as a task, is that what are you rendering? its too generic for most people. i can think markdown and several other things that I might render.

@floydwch
Copy link
Contributor Author

@ctalkington yeah, they are similar, it'd better be refactoring.

@floydwch
Copy link
Contributor Author

@ctalkington may be make another markdown task and employ render's helper in markdown's implement?

@floydwch
Copy link
Contributor Author

@ctalkington Oh sorry, I misunderstand your sentence.

@ctalkington
Copy link
Member

in general, i dont think anyone is going to mind setting one option either, say mode like we do for compress, we could simply have:

  • precompiled (acts just like jst)
  • compiled (like your pull)
  • computed (or another name, like jst #98)

I actually like the idea of a markdown but that's a little dif from underscore.

@ctalkington
Copy link
Member

moving this discussion to #115. i think we can use some your logic but not in its current state. will touch base to get some input when I have some sound ideas ready though!

thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants