r.js

'no such file' error when using grunt-requirejs compile

て烟熏妆下的殇ゞ 提交于 2020-01-05 12:23:32
问题 Since most issues with require.js build has to do with file structure and relative path reference, I created a repo here: https://github.com/ttback/requirejs-example for easier troubleshoot. The error is when i run grunt, I will get no such file or directory requirejs-example/src/js/bundle/js/bundle/utils.js This is due to the wrong baseUrl. I want it to be src/ but I can't set it since it goes to find the dependencies for src/js/bundle/main.js based on my Gruntfile. So the base is at src/js

Way to bundle require.js source with main.js

浪子不回头ぞ 提交于 2020-01-01 19:29:13
问题 I have a unique situation where I need to have both the source and main.js in one file and for everything to initialize within that file, so no require calls on the page. Is this possible? 回答1: If you want to include require.js with the main.js source, you can use this kind of command: node ../../r.js -o baseUrl=. paths.requireLib=../../require name=main include=requireLib out=main-built.js Since "require" is a reserved dependency name, you create a " requireLib " dependency and map it to the

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

Using requirejs optimizer node module with Gulp

£可爱£侵袭症+ 提交于 2019-12-20 14:43:40
问题 There's gulp-requirejs plugin, but it's blacklisted with the following message: "use the require.js module directly". The docs are quite sparse, how would I best use it in conjunction with Gulp build task? In the docs there's an example: var requirejs = require('requirejs'); var config = { baseUrl: '../appDir/scripts', name: 'main', out: '../build/main-built.js' }; requirejs.optimize(config, function (buildResponse) { //buildResponse is just a text output of the modules //included. Load the

requirejs, almond: A stand alone module built with almond loads all dependencies, but the main code is not executed

怎甘沉沦 提交于 2019-12-14 04:01:55
问题 I am trying to build a stand alone module with almond and this is my setup. The question is at the bottom. Abbreviated directory structure is: |-static |-core |-js |-require.js |-almond.js |-common.js |-app.build.js |-app |-myApp.js |-vendor |-js |-jquery.js |-bootstrap.js |-fancybox.js Abbreviated 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/bootstrap', 'fancybox':'../..

r.js - excluding specific list of files

女生的网名这么多〃 提交于 2019-12-13 15:30:47
问题 Hello evryone, I'm trying to find a way to make the r.js not to copy all the files form my /lib/ directory except for (for example) jquery.js and require.js . I'm using fileExclusionRegExp option to exclude all *.js files except for the above mentioned. fileExclusionRegExp: '\/lib\/(?!jquery|require).*\.js' But after the optimization, I can still see that other files have been copied over too. Is there anything I'm doing wrong ? Or is the regex incorrect? Thanks in advance 回答1: The problem

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

Understanding r.js options w/grunt & backbone and relative paths

梦想的初衷 提交于 2019-12-12 09:57:07
问题 I'm trying to figure out how to use r.js. I keep getting errors thrown such a module path does not exist, or files getting dumped where they shouldn't be. I've got a single page application that is integrated with wordpress. I've adopted this backbone boilerplate for my general structure, although I've set things up quite different. My file structure is shown below. .Theme Folder ├── _assets | ├── _application | | ├── css | | ├── fonts | | ├── img | | ├── _js | | | ├── main.js //this is my

Disable uglyfying in r.js

♀尐吖头ヾ 提交于 2019-12-12 07:32:55
问题 I am looking for a way to prevent r.js (RequireJS' optimization script) from ugylyfying our JS-modules to maintain readability for debugging purposes. I expect the script (running on Node.js by the way) to have some command line option to be passed. Unfortunately, the documentation if this tool is rather poor. 回答1: Pass optimize=none on the command line to r.js, or include optimize: "none" in your build script. eg: ({ baseUrl: ".", paths: { jquery: "some/other/jquery" }, name: "main", out:

Optimize RequireJS front-end application

二次信任 提交于 2019-12-12 03:34:48
问题 I am learning to use r.js to optimize/minify/uglify a front-end app. So far it is really cool and promising, but I am trying to figure out how to do one thing. I want to able to concatenate all the files (js,css,html) in a directory into one optimized file that I can put in a script tag on the front-end. So far I have only succeeded in putting only the JS files listed in my requirejs.config file into one optimized file. But I am wondering if there is a way to concatenate more files than just