eviltrout / emberreddit

A demonstration of how to use Ember without Ember Data.
58 stars 12 forks source link

Confusing use of EmberENV scripts in index.html #4

Open justin-hackin opened 9 years ago

justin-hackin commented 9 years ago

I was so-very-pleased to have a nice video and some demo code to go with on this topic. However, I'm trying not to just blindly copy-paste this into my code but instead to really understand what's going on. The one thing that really stumps me is the code in the index.html that goes:

 <script>
      window.EmberredditENV = {{ENV}};
      window.EmberENV = window.EmberredditENV.EmberENV;
    </script>
    ......
    <script>
      window.Emberreddit = require('emberreddit/app')['default'].create(EmberredditENV.APP);
    </script>

Perhaps just my noobishness, but it looks kindof hackish... being an educational resource and all, it would be really sweet to have some comments as to what's going on here... particularly, what's {{ENV}} ? And, is this still the proper way to include something like this ?

Thanks a lot for sharing :)

justin-hackin commented 9 years ago

So as it turns out, these scripts both 1) violate the default CSP 2) cause an invalid token { error for {{ENV}}

After over an hour of fiddling I couldn't manage to get this approach working in my app so it was rather disappointing... perhaps due to the shifting sands of change in Ember ...

toobulkeh commented 8 years ago

@justin-hackin did you ever find another source of example for this topic? The code and video are quite outdated at this point.