0

I'm working with the Hot Towel SPA template and I'm trying to add in some data that I want to get from breeze. I have the breeze nuget package installed and the breeze script files are in the scripts folder of the site.

I can reference it by using the actual file name like the following:

define(['durandal/app', '../scripts/breeze.min.js'], function (app, breeze) {
...
});

However, this will break when my site is running in release mode and the script is actually bundled. Plus, it is really ugly and feels like a hack to put the full name in there.

What is the correct way to do this?

Bryant
  • 8,660
  • 1
  • 33
  • 53

1 Answers1

0

By default Durandal loads external libraries via normal script calls not via requirejs. Same is true for HotTowel.

e.g. https://github.com/BlueSpire/Durandal/blob/master/index.html#L31

or if your platform supports it via bundling

https://github.com/johnpapa/PluralsightSpaJumpStartFinal/blob/master/SPAJumpStart/App_Start/BundleConfig.cs#L18

Simply load breeze before requiring main.js and you should be good to go.

RainerAtSpirit
  • 3,723
  • 1
  • 17
  • 18
  • But how do I reference it? – Bryant May 09 '13 at 19:39
  • `breeze` should be exposed as global if you pre-loaded it, so simply reference it in your code, same as `$` or `ko` in Durandal's samples/source. – RainerAtSpirit May 09 '13 at 19:57
  • Ok, so the problem was I was trying to pass in the breeze as a variable when I could just reference it using breeze. I was making it more difficult than it needed to be. :) – Bryant May 09 '13 at 20:12