requirejs

RequireJs: How to define extra dependencies for 3rd party library

谁说胖子不能爱 提交于 2019-12-13 05:25:01
问题 Basically I want to be able to load some module first before other. For example, I want bootstrap to load first before backbone. Can I declare dependencies like so? shim: { 'backbone': {deps: ['bootstrap']} } 回答1: Yes, that is the way to do it (in the require.config({ ... block of course.) It is also recommended to add an exports key and set it to Backbone . This will allow you to use Backbone inside a require or define block, as though it were a real AMD module: define(['backbone'], function

How can I use the “locals” option in jade compile(), client-side?

浪子不回头ぞ 提交于 2019-12-13 04:46:58
问题 What I'm trying to achieve Server is a Node.js application. I'd like to share code with the client as Jade template helpers (for functions) or globals (for objects/variables) . New helpers and globals should be available in every client template. This question is NOT about adding helpers to Jade when jade is used server-side. The code I wrote a RequireJS wrapper for Jade compile() function, passing the locals object (filled with properties to share) inside options : // ./wrappers/jade.js

requirejs: Build settings for a common.js module along with a main.js module where the result will be only two .js files served

a 夏天 提交于 2019-12-13 04:34:37
问题 When following the general setup of example-multipage provided in the docs the common.js module seems to cause dependencies to make async XMLHttpRequest calls. my directory structure is: |-static |-core |-js |-myApp.js |-require.js |-common.js |-app.build.js |-app |-myApp.js |-vendor |-js |-jquery.js |-bootstrap.js |-fancybox.js contents of common.js: require.config({ baseUrl: "/static/core/js", paths: { 'jquery':'../../vendor/jquery/1.7.2/jquery', 'bootstrap':'../../vendor/bootstrap/2.2.2/js

requireJS worked for one plug-in, but not another

廉价感情. 提交于 2019-12-13 04:33:59
问题 I previously asked this question, and got one plug-in to work. Now, I'm trying to get another plug-in to work using the solution for the first plug-in, but that solution isn't working. I'm trying to get this plug-in to work, but the chrome console spits out this error: Uncaught ReferenceError: jQuery is not defined :3000/js/libs/textarea_auto_expand.js:41 My code is this: require.config({ paths: { jquery: '/js/libs/jquery/jquery-2.0.3', underscore: '/js/libs/underscore/underscore-min',

_meteor_bootstrap_.require not working in Meteor 0.6.4.1

百般思念 提交于 2019-12-13 04:32:48
问题 The code I inherited use _meteor_bootstrap.require, an internal meteor details, to load module. Look like it's no longer working with 0.6.4.1? any suggestions of how I should load modules? Current code require = meteor_bootstrap.require Future = require (fibers/future) The error message I got: C:\Program Files (x86)\Meteor\lib\node_modules\fibers\future.js:173 throw(ex); ^ TypeError: undefined is not a function at app/server/main.coffee.js:7:10 at C:\Users\jhuang\Documents\Tervela\5.0.16\i32

How to convert a RequireJS function to plain jQuery?

蓝咒 提交于 2019-12-13 04:19:18
问题 I am fairly new to jQuery and just as I was starting to get the hang of it, I came across a site that I am trying to view offline that uses requireJS. I think there is a lot going on in the app that is making the requireJS functionality break down. So I am trying to get rid of all app-specific functionality (since I already loaded the pages and saved resources for offline viewing) and just have pure jQuery handling all the page interaction (like audio players, content revealers, etc). Here is

Trying to integrate RequireJS into a Typescript project

本秂侑毒 提交于 2019-12-13 03:59:37
问题 I am trying to add RequireJS to my Typescript + JQuery project, for which I need to compile my typescript file with the AMD option which I am not able to do. Here's the console output in webstorm. C:/Users/Me/AppData/Roaming/npm/tsc.cmd --sourcemap config.ts --module commonjs --module AMD main.ts error TS5007: Cannot resolve referenced file: 'main.ts'. I am trying to follow the instructions on "Definitely Typed". https://github.com/borisyankov/DefinitelyTyped/tree/master/requirejs. I guess

Requirejs: Load a module where the require('path/to/module') comes from a variable?

风流意气都作罢 提交于 2019-12-13 03:57:39
问题 Is it possible to do this: define( function( require ){ var path = 'json!/app/pagelang/login'; var appLang = require(path), instead of this: define( function( require ){ var appLang = require('json!/app/pagelang/login'), from my tests it's not possible because it results on the following console error: Uncaught Error: Module name "json!/app/pagelang/login_unnormalized2" has not been loaded yet for context: _ 回答1: Yes, you just have to change your syntax a little: define( function( require ){

BackboneJS + Require JS + Wookmark.js plugin not working

孤街醉人 提交于 2019-12-13 03:51:46
问题 I have a Backbone App bound together with RequireJS. Now I want to use the Wookmark plugin https://github.com/GBKS/Wookmark-jQuery but for some reason I cant get it running. So I did the following: My config.js: require.config({ deps: ['main'], paths: { jquery : '../lib/jquery-2.1.0.min', underscore : '../lib/lodash-2.4.1', backbone : '../lib/backbone', layoutmanager : '../lib/backbone.layoutmanager', handlebars : '../lib/handlebars/handlebars-v1.3.0', imagesLoaded : '../lib/jquery