1

Having two different projects, a framework and an app which uses this framework, I would like to use requirejs optimizer to minify both together.

Files:

/framework/
  js/
    some.js
    other.js
    framework.js

/app/
  js/
    main.js
    module.js

I want to create an app.min.js with requirejs optimizer which includes the framework files, and the app files, in the right order.

However, I want the framework to be able to minify itself, so define() and require() calls in the framework are relative to the framework.js file.

The problem is that if I try to optimize my app, it won't find the framework files because the relative paths used in the framework (like define(['./some'], ...)) won't work if I optimize from my app.

How can I do this properly ?

Thibaut D.
  • 2,521
  • 5
  • 22
  • 33

1 Answers1

0

There might be a better way, but you can represent paths as variables

e.g. relative paths in framework can be 'framework/some' and config can define 'framework/' to be '.' in the framework app. and define 'framework/' to be '../framework' in the app's config.

David Lee
  • 171
  • 6