These are chat archives for canjs/canjs

9th
Feb 2017
xedos
@xedoken
Feb 09 2017 13:33 UTC

Hello guys! I have a little question for you:

I use canjs with symfony2 php framework, symfony has twig template engine with stache like syntax. So the problem is:

I need insert some twig expressions in stache template like each(with twig data) and conditionals, but when i export canjs app it throws error about these twig parts, can i write that twig parts as raw? like canjs and steal dont look at these blocks and leave them as it is? thank you :)

the part of twig code i wanna insert:

{% for avatarExample in avatarExamples %}
   <li>
       <a href="#">
           <img style="width:50px;height:50px;" src="{{ asset( ('uploads/avatar-examples/' ~ avatarExample.path) ) }}" data-image="{{ asset( ('uploads/avatar-examples/' ~ avatarExample.path)) }}" alt=""/>
        </a>
   </li>
{% endfor %}

and smth like this:

url: "{{ path('admin_save_avatar_preset') }}"
Matthew Phillips
@matthewp
Feb 09 2017 17:36 UTC
can you put it inside of stache comments?
xedos
@xedoken
Feb 09 2017 17:44 UTC
hm, so when i export my canjs app with steal this comment twig tag will display as usual?
i found safeString in canjs docs, but it doesn't helps :(
Dovid Bleier
@dbleier
Feb 09 2017 18:24 UTC
I am using can-connect superMap on 2.3 and have one model that I want to completely disable caching and hit the server anytime getList() is called. Anyway I can easily do that?
Kevin Phillips
@phillipskevin
Feb 09 2017 18:32 UTC
don’t use superMap
Chasen Le Hara
@chasenlehara
Feb 09 2017 18:32 UTC
Yeah, I think using base-map with just the behaviors you want is probably the best solution.
Chasen Le Hara
@chasenlehara
Feb 09 2017 18:50 UTC
@xedoken, am I understanding you correctly in that it’s stache that’s throwing an error when it’s parsing that template?
Dovid Bleier
@dbleier
Feb 09 2017 18:52 UTC
@phillipskevin ok, thanks I'll try that
actually, I couldn't just override the cacheConnection property, like just set it to null?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Feb 09 2017 18:56 UTC
Kevin Phillips
@phillipskevin
Feb 09 2017 18:57 UTC
@dbleier I don’t think there’s a way to do that
Dovid Bleier
@dbleier
Feb 09 2017 18:57 UTC
ok
Mohamed Cherif Bouchelaghem
@cherifGsoul
Feb 09 2017 19:02 UTC
@xedoken you can not use twig expression inside stache templates, but the inverse is ok as long as the stache part is in raw filter like jinja with handlebars in this example (Twig is a php port of jinja) https://coderwall.com/p/fy6vka/how-jinja2-and-handlebars-js-can-co-exist