requirejs

backbone with requirejs

安稳与你 提交于 2019-12-24 14:03:55
问题 I am building a complex web app and trying to use requirejs with backbone. I found out that backbonejs is a non AMD framework which restricts me to use requirejs out of the box. I researched on internet and found that there are patches available to make backbone AMD compliant. Please guide if patching this way is a no-issue setup. Will i run into any issues during the app development due to patching of core file in backbonejs? I apologise if its a stupid question :) 回答1: Nope, it's not a

How to run TypeScript in Visual Studio 2015 without require() or requireJS

自古美人都是妖i 提交于 2019-12-24 09:18:58
问题 I've setup a new web project where I wanted to begin working/learning TypeScript. This project while an empty c#.net web project is not using MVC, angular, etc. It is just plain vanilla html and Ts. Everything was running smooth until I started setting up modules (classes, interfaces etc.) Once I started exporting and importing the modules I began receiving in the dev tools the error Uncaught ReferenceError: require is not defined . Looking at the actual js file I can see it is wrapping the

View loading before main layout is loaded

陌路散爱 提交于 2019-12-24 08:56:33
问题 This is a followup question from Backbone boilerplate: "this.model is undefined". I was able to work out some of the structure, but have run into a new problem. I'm using backbone boilerplate, which uses the layoutManager adapter for setting the views. The main view, as well as the subsequent first view, seems to be loading all of the assets correctly, though the subsequent view seems to be firing before the main view gets loaded in. Here is my router file: define([ // Application. "app", /

How to load Vue.js using Require.js

断了今生、忘了曾经 提交于 2019-12-24 08:50:06
问题 I am using Angularjs in my application and I'm trying to create a page inside using Vue.js . For that, I installed Vue using bower and called it's directory inside my require.js file, like this: 'vue': '../vendor/vue/dist/vue' shim: { 'vue': { deps: ['jquery'] }, } After that I have dashboard.js that is a base/parent file, where I call angular and vue (among others) require([ 'angular', 'vue', 'i18next', 'translations', 'raven-js', 'raven-angular', ], function (angular, Vue, i18next,

Require.js optimizer - Trouble getting going

纵饮孤独 提交于 2019-12-24 08:22:37
问题 Good morning, I have been messing around with the Require.js optimizer this morning and was having trouble getting started. I am running windows 8, and have created a modular backbone.js application that I am now ready to package for deployment (production). I would now like to optimizer theses files (concat and minimize), r.js optimizer seems like just the trick. The problem I am running into is when trying to run the classpath command. java -classpath path/to/rhino/js.jar;path/to/closure

require.js is requesting html files but serving them as script elements

我与影子孤独终老i 提交于 2019-12-24 07:14:49
问题 I'm using the require.js text plugin with the text! syntaxt to render xhr responses as html. text : 'libs/require/text' ... In my views I have defined them as define([ 'text!templates/categories.html' , 'models/Categories' , 'views/CategoryView' ], ... Everything works as it should locally. However when I pushed this code to a server it started loading the *.html as <script></script> elements. Further more, it was attaching a .js extension to the .html file name as well. ANy thoughts? The

Calling Chai plugin in Intern returns error

你说的曾经没有我的故事 提交于 2019-12-24 06:42:47
问题 I was trying to use the sinon-chai plugin within Intern but it gave me: Error {stack: (...), message: "Cannot find the Node.js require"} I had installed the plugin via npm and here's my test file: define([ 'intern!bdd', 'intern/chai!expect', 'app/functions', 'intern/chai', 'intern/dojo/node!sinon-chai' ], function (bdd, expect, myapp, chai, sinonChai) { chai.use(sinonChai); ... }); What might go wrong? 回答1: The node loader requires Node.js, so it can't be used in the browser. You'll need to

Using require.js with Twitter Boostrap API and backbone

我与影子孤独终老i 提交于 2019-12-24 02:43:25
问题 Regarding this entry Loading Backbone and Underscore using RequireJS it is quite clear to me how do I configure Backbone -specific scripts and JQuery . But how do I: configure Twitter bootstrap.js ? what about json2.js ? Thanks! 回答1: In addition to what you learned about the path config option, you should also review the shim config option http://requirejs.org/docs/api.html#config-shim. Many plugins are not AMD ready so you have two options. Either configure it as a shim (suitable for most

Use AMD defined module within 3rd party, non-AMD library

泪湿孤枕 提交于 2019-12-24 02:13:12
问题 I have a library - call it SomeLib - which is defined to support various module loaders: (function(global, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof module !== 'undefined' && module.exports) { module.exports = factory(); } else { global.UriTemplate = factory(); } })(this, function() { ... // returns constructor function }); I can easily load it with RequireJS like require.config({ paths: { 'theLibrary: '../path/to/the/lib' } }); Then I

EmberJS - Manually bind controller to view

久未见 提交于 2019-12-24 01:59:13
问题 Lately EmberJS changed a lot (Router, ...) and the code I have started to write less than a month ago is now broken. One of the issue I have right now is I am not able to manually bind the controller to the view. I am using requireJS by the way... So I used to the able to do something like this (here to define the view for my menu and the menu items), to actually get the Controller content and selected properties. define ( 'app/common/views/menu', [ 'text!app/common/templates/menu.hbs',