You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using ect for a while and dig its features. For a while, as well, I've been doing <%- @_.unique(@headScripts).join('') %> within my <head />, where @_ is underscore, @headScripts is an array that ends up looking like (after every partial has pushed it's scripts to it [js / css])
// something like this
@headScripts == [
'<script src="myscript.js"></script>',
'<script src="other.js"></script>',
'<link rel="stylesheet" type="text/css" href="/stylesheet.css" />',
];
You see, doing <% block 'head' %> doesn't work because its a gumby character, but moreover, it can only be overridden by one thing and not pushed to ( as far as i know ). PSUEDO CODE( but it probably works )
So is there a way (if not--should there be), to have multiple items feeding into one block, such that I could have the same structure I am doing now, so that the main layout can have scripts pushed to it from all child templates?
For me, this functionality is necessary, though i'm a little tired of writing it how I am writing it, since the html needs to be a string. If template gets included into a page, for simplicities sake, I would like that template to include its own javascript, but if it is an index item, it should not include it multiple times, and it should be in the head. So the functionality of using it like this works fine, however the syntax is where I am not fully satisfied and that'd be a feature request of the compiler.
The text was updated successfully, but these errors were encountered:
danschumann
changed the title
Pushing to blocks
Pushing to blocks from multiple children
Aug 25, 2014
<% @_.each @headBlocks, (b) =>: %>
<% content b %>
<% end %>
It seems that though 'core_home_index' looks like a string, it is required to be written out twice(WET), because if it is turned into a variable it does not work with block
While it may be true that using requirejs would solve all of my problems, I still am not a huge fan of that library. I prefer all dependencies included in head at load time.
Hello,
I've been using ect for a while and dig its features. For a while, as well, I've been doing
<%- @_.unique(@headScripts).join('') %>
within my<head />
, where@_
is underscore,@headScripts
is an array that ends up looking like (after every partial has pushed it's scripts to it [js / css])You see, doing
<% block 'head' %>
doesn't work because its a gumby character, but moreover, it can only be overridden by one thing and not pushed to ( as far as i know ). PSUEDO CODE( but it probably works )js.js
posts/index.ect
posts/index_item.ect
layout
So is there a way (if not--should there be), to have multiple items feeding into one block, such that I could have the same structure I am doing now, so that the main layout can have scripts pushed to it from all child templates?
For me, this functionality is necessary, though i'm a little tired of writing it how I am writing it, since the html needs to be a string. If template gets included into a page, for simplicities sake, I would like that template to include its own javascript, but if it is an index item, it should not include it multiple times, and it should be in the head. So the functionality of using it like this works fine, however the syntax is where I am not fully satisfied and that'd be a feature request of the compiler.
The text was updated successfully, but these errors were encountered: