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
12
votes
1 answer

npm + Mocha + RequireJS

I'm having quite the time trying to set up node/npm with Mocha and RequireJS. Here's what I've done. I've created a testing/ directory, with this structure: testing/ | +-- package.json | +-- README.md | +-- test/ | …
Mr Mikkél
  • 2,377
  • 4
  • 26
  • 50
6
votes
3 answers

Excluding file from optimizing in Durandal build

I'm using Grunt to build the Durandal starter kit pro package. It all works fine, except for one tiny detail. I would like to exclude one file (app-config below) from the optimizer and keep it as a non minified file when my build is done. Based on…
Johan
  • 31,613
  • 48
  • 166
  • 272
6
votes
2 answers

Jquery object converted to normal variable after minifying with RequireJS optimizer r.js

I have this function in CoffeeScript render: -> _.each @$elements, ($el) => if $el[0].id is 'tabs-div' emptySlate = "

no data available

" @setEmptyPlacholde($el, emptySlate) …
Nouran Mahmoud
  • 265
  • 1
  • 2
  • 13
5
votes
1 answer

How to use RequireJS optimizer in Play framework?

As advertised, the rjs in Play can ensure that any JavaScript resources referenced from within a WebJar are automatically referenced from the jsdelivr CDN. In addition if any .min.js file is found then that will be used in place of .js. An…
Khanetor
  • 9,495
  • 8
  • 31
  • 67
4
votes
2 answers

Make Cordova wait for async hook to finish

In my Cordova project, I have a hook which does RequireJS optimization (r.js) on after_prepare. That optimization is inherently asynchronous, so my hook code returns before all optimization is fully finished. For example, this causes issues when…
Cedric Reichenbach
  • 8,157
  • 6
  • 50
  • 82
4
votes
2 answers

Can I combine RequireJs modules AND require.js itself into one js-bundle

I'm using RequireJs Optimizer to combine all modules into one file - app.js On production I have two js files: app.js and require.js Production HTML has following script tag: This will result in…
artin
  • 1,425
  • 15
  • 19
4
votes
2 answers

Embedded ember-cli project conflicts with RequireJS

I'm trying to embed an EmberJS application into a large portal application which uses extensively the RequireJS library. I'm using ember-cli to build the project. The built application consists of two files, dist/assets/vendor.js and…
janhink
  • 4,744
  • 2
  • 27
  • 37
4
votes
1 answer

Require.js Optimizer incorrectly ordering shim dependencies

I have a web application that uses Require in order to load dependencies. I have a set of JS libraries that are included using the Require config.shim object. Two such example libraries are: require.config({ shim: { "libs/leaflet": { …
Patrick D
  • 5,910
  • 3
  • 41
  • 51
4
votes
1 answer

Play 2.3 requireJs optimization and shim for multiple modules

This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation. requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells…
angelokh
  • 9,394
  • 6
  • 61
  • 119
3
votes
2 answers

RequireJS: Uglification Not Working

I must be making a mistake somewhere, but it's not being written to stdout during optimization. I'm trying to optimize a file via requirejs, but the output isn't being minified. According to the documentation, UglifyJS should minify the code. At…
Andrew
  • 4,648
  • 9
  • 33
  • 49
3
votes
0 answers

requireJS optimizer - combining two anonymous modules into one combined.js file

I am trying to combine two require amd modules into one combined.js javascript file using RequireJS optimizer. **This question is not the same than this one: Mismatched anonymous define() module where there is not a solution or detailed explanation…
xtrm
  • 888
  • 8
  • 21
3
votes
1 answer

Why does r.js combine and minify JS, then copy all the files to output dir?

I've been working with the RequireJS optimizer to create multiple optimized JS files for my project and have come across a problem that I’ve found mentioned in other posts but have not found a solution for. When using r.js to optimized a single…
DaveR
  • 1,059
  • 1
  • 9
  • 26
3
votes
0 answers

RequireJS optimization fails when referencing a plugin (xstyle/css)

I followed the example file structure as described in http://requirejs.org/docs/optimization.html and got a working build. I then modified two.js to look like this: define(["xstyle/css!app/css/main.css"], function () { …
Corey Alix
  • 2,349
  • 2
  • 21
  • 35
2
votes
0 answers

Using fallback paths with RequireJS Optimizer

My goal is to have a dependency, foo, to load from a CDN with a local fallback and to use RequireJS optimizer (r.js) to bundle and minify everything else. require(['foo'], function (foo) { /*...*/ }) calls should work without errbacks - at least not…
Şafak Gür
  • 6,389
  • 3
  • 52
  • 87
2
votes
1 answer

RequireJS Optimizer hard include

I have a large-scale client-side project which I would like to bundle into 2 bundles instead of 1. This is my dependency tree: The desired output would be to have these bundles: main that includes b x that includes just a (as b is already included…
johni
  • 4,766
  • 5
  • 33
  • 63
1
2 3 4 5 6