I run an optimizer like this
sudo /usr/local/bin/node /tmp/rj/r.js -o name=main out=test.js baseUrl=.
for the test
Now, how can I tell the optimizer to output the file name as a hash of the content (obviously to set max expires) and then rename the dependency to the appropriate call requests?
An example situation would be something like this
require({ baseUrl: '{{ STATIC_URL }}js', paths: { jquery: 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min', jqueryui: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min' } }, ['order!jquery','order!jqueryui','order!main']);
requirejs should pull something like 13KUJAW78M.js
Based on the Miller Medeiross Proposal I plan to put all the required calls into one main file. It also means that all such calls must also be optimized.
eg
switch(document.location.pathName){ case '/foo': require(['sections/foo/main']); break; case '/foo/bar': require(['sections/foo/main', 'core/bar']); break; default: require('sections/home'); }
required (['sections / foo / main']);
must be optimized for the hash of the file.
Can anyone help?
Quintin par
source share