requirejs

TypeScript: import module with only statements

我与影子孤独终老i 提交于 2020-01-13 09:24:08
问题 I have a page-a.ts which would compile into page-a.js : alert('this is from page-a'); And I have a main.ts which compiles into main.js : import pageA = module('page-a') alert('this is from main'); And this is my tsc command line: tsc --module amd page-a.ts main.ts And I'm using requirejs like this: <script src="require.js" data-main="main.js"></script> I can't see the alert messagebox from page-a when loading the page. And in the generated scripts main.js , there is nothing about page-a . My

Can Blanket.js work with Jasmine tests if the tests themselves are loaded with RequireJS?

房东的猫 提交于 2020-01-13 06:57:11
问题 We've been using Jasmine and RequireJS successfully together for unit testing, and are now looking to add code coverage, and I've been investigating Blanket.js for that purpose. I know that it nominally supports Jasmine and RequireJS, and I'm able to successfully use the "jasmine-requirejs" runner on GitHub, but this runner is using a slightly different approach than our model -- namely, it loads the test specs using a script tag in runner.html, whereas our approach has been to load the specs

How does AMD (specifically RequireJs) handle dependancies across multiple modules

你说的曾经没有我的故事 提交于 2020-01-12 14:30:08
问题 I have my main initialization script which calls require() and one of the dependencies is a utilities framework, but some of the other modules that I'm specifying via require() also themselves have defined this framework as a dependency. For example (init.js): require(['module-a', 'module-b', 'module-c'], function(a, b, c){ // where module-c is the framework }); And then in 'module-a' I have: define(['module-c'], function(c){ // utilize module-c framework }); So how does AMD/RequireJs handle

How does AMD (specifically RequireJs) handle dependancies across multiple modules

本秂侑毒 提交于 2020-01-12 14:28:39
问题 I have my main initialization script which calls require() and one of the dependencies is a utilities framework, but some of the other modules that I'm specifying via require() also themselves have defined this framework as a dependency. For example (init.js): require(['module-a', 'module-b', 'module-c'], function(a, b, c){ // where module-c is the framework }); And then in 'module-a' I have: define(['module-c'], function(c){ // utilize module-c framework }); So how does AMD/RequireJs handle

Loading templates with backbone js

喜你入骨 提交于 2020-01-12 14:05:12
问题 I'm starting in javascript development, and did a simple project with node.js as a rest API and a client using backbone, everything look perfectly till I want to get my templates out of my js. I found different approaches, some of them with some time (like one year old) but I can't understand which one could be better: A .js file with a var with the html code pros -> easy to load, easy to pass to underscore to compile it. cons -> scape every single line. app.templates.view = " \ <h3>something

Loading templates with backbone js

流过昼夜 提交于 2020-01-12 14:01:33
问题 I'm starting in javascript development, and did a simple project with node.js as a rest API and a client using backbone, everything look perfectly till I want to get my templates out of my js. I found different approaches, some of them with some time (like one year old) but I can't understand which one could be better: A .js file with a var with the html code pros -> easy to load, easy to pass to underscore to compile it. cons -> scape every single line. app.templates.view = " \ <h3>something

Loading templates with backbone js

跟風遠走 提交于 2020-01-12 14:00:12
问题 I'm starting in javascript development, and did a simple project with node.js as a rest API and a client using backbone, everything look perfectly till I want to get my templates out of my js. I found different approaches, some of them with some time (like one year old) but I can't understand which one could be better: A .js file with a var with the html code pros -> easy to load, easy to pass to underscore to compile it. cons -> scape every single line. app.templates.view = " \ <h3>something

How to use precompiled templates in Handlebars with RequireJS?

南楼画角 提交于 2020-01-12 07:52:05
问题 I'd like to precompile my Handlebars templates, but I'm not sure how this works in development mode. Is it common practice have some background process like Guard running to constantly monitor changes to Handlebars template files? I'm using RequireJS to pull in templates; e.g.: define(['jquery', 'handlebars', 'text!templates/my_template'], function($, Handlebars, myTemplate) { // ... var data = {"some": "data", "some_more": "data"}; var templateFn = Handlebars.compile(myTemplate); $('#target'

Requirejs, d3 and nvd3 integration

笑着哭i 提交于 2020-01-12 05:30:09
问题 I'm facing the problem of integrating requirejs with d3 and nvd3, and i found an easy solution using require's shim. Using the shim i can export a variable, and i can also define dependencies: d3: { exports: 'd3' }, nvd3: { exports: 'nv', deps: ['d3'] }, In this way, i simply install d3 and other packages with bower, and include them with require, and it is really quick and clean. Nonetheless, i faced the following problem: there are probably some clashes between the global d3 variable and

Routing problems with Codeigniter and Backbone.js

拥有回忆 提交于 2020-01-12 03:53:24
问题 Here are the frameworks I am using: Codeigniter Codeigniter REST API Require.js Backbone.js Running the app: The htaccess file redirects everything through the Codeigniter index.php file. There is a default route setup in Codeigniter to call the "Start" Controller. The Start Controller calls the Start View (the only view in Codeigniter ). The Start View holds the template for the entire website and makes a call to start Require.js Require.js starts up Backbone and app works as expected.