requirejs-text

RequireJS text plugin: cannot load HTML from other domain

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 15:02:49
问题 I'd like to fetch some html from another domain with require.js. I know that CORS policies doesn't allow this easily. Note: I have configured the web server (with Access-Control-Allow-Origin "*" and other directives) and require.js so far that all JS and CSS files (css with require-css plugin) gets loaded from the other domain as expected - just fetching html makes problems. But in the browser network protocol I can see that the html content even gets loaded. However, this content does not

RequireJS - Isolating jQuery versions and plugins within contexts

谁说我不能喝 提交于 2019-12-23 07:48:40
问题 I have a project which utilizes multiple require contexts and dynamically loaded jQuery versions and plugins. (The jQuery versions will be centrally sourced and will not be inlined). jQuery integrity for the host and each context as well as plugin isolation are critical. I am writing a loader plugin for RequireJS to handle the following use cases: Within a specific require context And without affecting the fn of the hosting page or any other require context, I would like to: Load any version

Inlining require.js text! using Grunt

白昼怎懂夜的黑 提交于 2019-11-30 12:09:25
I've been experimenting with Grunt and Require JS this afternoon. I'm a big fan of the text module and use it to bring in my templates. In non-Grunt based projects I used the inlineText and stubModules Require JS options to in-line the template files and it works great. However, I'm having trouble getting this to work with Grunt. Require Config require.config({ paths: { // Using Bower for dependency management text: '../components/requirejs-text/text' } }); Usage define(['text!template.html'], function (html) { // Do stuff with html }); Gruntfile.js requirejs: { dist: { options: { baseUrl:

Inlining require.js text! using Grunt

纵然是瞬间 提交于 2019-11-29 17:57:02
问题 I've been experimenting with Grunt and Require JS this afternoon. I'm a big fan of the text module and use it to bring in my templates. In non-Grunt based projects I used the inlineText and stubModules Require JS options to in-line the template files and it works great. However, I'm having trouble getting this to work with Grunt. Require Config require.config({ paths: { // Using Bower for dependency management text: '../components/requirejs-text/text' } }); Usage define(['text!template.html']

Invoke the text plugin from requirejs mapping

烈酒焚心 提交于 2019-11-29 12:45:52
问题 I'm writing a web app using TypeScript, Backbone, and Mustache. I want to use Requirejs for dependency loading. I'm also using the Web Essentials visual studio plugin for TypeScript with the AMD compilation option turned on. For those that are not familiar with this, it will wrap your type script file in an AMD module if you import external modules. For example: In type script I import the following modules in type definition files. export import Backbone = module("Backbone"); import

Read local file in AngularJS

独自空忆成欢 提交于 2019-11-28 07:45:54
I used to work with RequireJS and Backbone and used requirejs/text and requirejs-plugins to load local json files I normally use for configuration. How does one achieve the same with AngularJS? Everyone seems to suggest to use $http, but is this the only way? Do I really need to make 20 calls if I have 20 configuration files? Maybe something like ng-constant is the "preferred" way? This is what I did. But it uses $http though so I'm hoping someone has a better solution. app.js: var myModule = angular.module('myApp', []); myModule.config(function($routeProvider, $locationProvider) {

Read local file in AngularJS

限于喜欢 提交于 2019-11-27 01:59:00
问题 I used to work with RequireJS and Backbone and used requirejs/text and requirejs-plugins to load local json files I normally use for configuration. How does one achieve the same with AngularJS? Everyone seems to suggest to use $http, but is this the only way? Do I really need to make 20 calls if I have 20 configuration files? Maybe something like ng-constant is the "preferred" way? 回答1: This is what I did. But it uses $http though so I'm hoping someone has a better solution. app.js: var