I’ve builded a app with symfony2 the app expose an REST Api.
now i build a simple client for consuming
app.coffee -> app.js
App = Em.Application.create
ready: ->
@.entradas.load()
Entrada: Em.Object.extend()
entradas: Em.ArrayController.create
content: []
load: ->
url = 'http://localhost/api/1/entrada'
me = @
$.ajax(
url: url,
method: 'GET',
success: (data) ->
me.set('content', [])
for entrada in data.data.objects
me.pushObject DBPlus.Entrada.create(entrada)
)
MyBundle:Home:index.html.twig
<script type="text/x-handlebars" src="{{ asset('js/templates/entradas.hbs') }}"></script>
<script src="{{ asset('js/libs/jquery-1.7.2.min.js') }}"></script>
<script src="{{ asset('js/libs/handlebars-1.0.0.beta.6.js') }}"></script>
<script src="{{ asset('js/libs/ember-1.0.pre.min.js') }}"></script>
<script src="{{ asset('js/app.js') }}"></script>
the problem here is when i run on dev enviroment and link the template like <script type="text/x-handlebars" src="{{...}}"> the app dont work, nothing show but works fine over prod enviroment.
he only way that works on dev enviroment is inline template
MyBundle:Home:index.html.twig
<script type="text/x-handlebars">
{% raw %}
<ul class="entradas">
{{#each App.entradas}}
<li class="entrada">{{nombre}}</li>
{{/each}}
</ul>
{% endraw %}
</script>
config_dev.yml
Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
with rake-pipeline, I wrote a AssetFile with the following code:
and in my
layout.html.twiginclude