Questions tagged [requirejs-optimizer]

The requirejs-optimizer is part of the r.js adapter for Node and Rhino, and it is designed to be run as part of a build or packaging step after you are done with development and are ready to deploy the code for your users.

The is part of the r.js adapter for and , and it is designed to be run as part of a build or packaging step after you are done with development and are ready to deploy the code for your users.

has an optimization tool that does the following

  • Combines related scripts together into build layers and minifies them via UglifyJS (the default) or Closure Compiler (an option when using Java).
  • Optimizes by inlining CSS files referenced by @import and removing comments.

Home Page: http://requirejs.org/docs/optimization.html

87 questions
0
votes
1 answer

Use requirejs in gruntjs to build a library, and use it in other projects

I am building a library which is a set of folders containing Model View Controller Javascript files. Each files has dependencies declared using require syntax: define([ 'modules/moduleA/src/moduleAModel', …
0
votes
2 answers

RequireJS optimize multi-page app using map config

I'm trying to modularize my existing project by breaking out functionality into separate applications that share a lot of common code. It's a Backbone/Marionette app, and everything is working fine in development mode, but I'm having trouble getting…
0
votes
1 answer

RequireJS baseUrl and multiple optimized files

I've separated out my 3rd party libraries from my app code and grouped them all together into a vendor.js file for requirejs to pull in. In my build.js file, I'm using the modules syntax to optimize my main application, excluding the vendor scripts,…
ken.dunnington
  • 865
  • 7
  • 20
0
votes
0 answers

Issue with r.js optimizer and Underscore _.template() function

I have an issue with Underscore (I use an old version [1.3.3] and can't use others for this project) _.template() function after creating optimized build. After optimizing I have a file with all my initial modules. Underscore (like jQuery) also…
0
votes
1 answer

Exclude everything but Javascript files in RequireJS Optimizer

I am using RequireJS optimizer in a gulp recipe to compile and concatenate my Modules but redundant 3rd party library files like bower.json and *.nuspec files are being copied to my output directory. I have successfully managed to exclude full…
J.m.clerck
  • 36
  • 3
0
votes
1 answer

How to have multiple output files in gruntfile.js when running requirejs

In Gruntfile.js for grunt-contrib-requirejs I can only register one task and I can only have one output file i.e. home_scripts.pack.js. However, I want to have as many as I want output files based on different 'include' criteria. For example,…
partizan
  • 449
  • 1
  • 8
  • 21
0
votes
1 answer

Optimization fails when passing a variable with a list of dependencies to define()

When we are running our site in debug mode without minifying the script this works: var defines = [ 'globals', 'templates' ]; define(defines, function(globals, templates) { //code... }); But as soon the code is minified it stops to…
PaRoxUs
  • 99
  • 1
  • 10
0
votes
1 answer

Variable in require path not working with r.js

I am new to r.js optimization but a fan of requirejs build-config.js ({ appDir: "./src/main/webapp/webresources/javascript/", baseUrl: "./", dir: "./target/webresources/js", optimizeCss: "none", mainConfigFile:…
coding_idiot
  • 12,860
  • 9
  • 56
  • 111
0
votes
1 answer

Require.js r.js: Compile directory to single file

Is there any way to configure RequireJS to compile an entire directory to a single file? I don't mean the normal use case of the 'out' setting. I'll try to explain by example. If I have the following project structure: - app - main.js -…
Barguast
  • 5,032
  • 6
  • 36
  • 67
0
votes
1 answer

Requirejs Optimizes multiple projects or pages

How can I optimize my multiple requirejs projects? For instance I have this structure below where I have two main.js in different locations/ folders, build/ build.js dev/ index.php core/ js/ main.js libs/ …
laukok
  • 47,545
  • 146
  • 388
  • 689
0
votes
1 answer

Cache-busting scheme incompatible with r.js (require.js)?

In my application, I want to have an environment config that uses a different version name for every deploy so that the application is properly cache busted and users don't have stale versions of code in their browser cache. Note I have been…
Daniel
  • 1,603
  • 15
  • 13
0
votes
1 answer

Requirejs optimizer. Exclude all dependencies

I'm using requireJS in Rails application with requirejs-rails gem. What I'm trying to achieve is to create several bundles which contain common code. For example libs_a, libs_b, libs_c, ... Then for some pages of the application create own bundles…
0
votes
1 answer

Can requirejs optimizer work with relative paths?

Here is a sample application demonstrating the issue (sorry no fiddle since it's about r.js which is node based) I can't get the requirejs optimizer to work properly with relative paths. my web app has the following directories app index.html -…
George Mauer
  • 103,465
  • 117
  • 349
  • 581
0
votes
1 answer

With RequireJS optimization, are templates added to the build file or stay "on demand"?

Using RequireJS, after optimization using r.js are files loaded via the text plugin (like templates) downloaded on demand or included in the single optimized build file?
JL Gradley
  • 1,205
  • 2
  • 11
  • 14
0
votes
1 answer

Why I have to use 'include' again in grunt-requirejs to optimize into a single js file?

I'm trying to use grunt-requirejs to optimize my requirejs project into a single production js file. However, I'm not sure if my Gruntfile.js is correct because I have to specify which model to include during the optimization again, which seems…
toy
  • 10,405
  • 19
  • 76
  • 161