Hello all
The Amber IDE is loaded through <script type='text/javascript' src='support/amber.js'></script> <script type='text/javascript' src='support/requirejs/require.min.js'></script> Then amber.js pulls in a lot of small js files from the 'support' and 'js' directory. How can I reconfigure this so that I need only one or two large file? Kind regards Hannes -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Not tried, but there is thing called require.js optimizer which does exactly this.
H. Hirzel wrote: > Hello all > > The Amber IDE is loaded through > > <script type='text/javascript' src='support/amber.js'></script> > <script type='text/javascript' > src='support/requirejs/require.min.js'></script> > > Then amber.js pulls in a lot of small js files from the 'support' and > 'js' directory. > > How can I reconfigure this so that I need only one or two large file? > > Kind regards > > Hannes > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Thank you, Herby. Has anybody done this following
requirejs.org/docs/optimization.html ? On 8/29/13, Herby Vojčík <[hidden email]> wrote: > Not tried, but there is thing called require.js optimizer which does exactly > this. > > H. Hirzel wrote: >> Hello all >> >> The Amber IDE is loaded through >> >> <script type='text/javascript' src='support/amber.js'></script> >> <script type='text/javascript' >> src='support/requirejs/require.min.js'></script> >> >> Then amber.js pulls in a lot of small js files from the 'support' and >> 'js' directory. >> >> How can I reconfigure this so that I need only one or two large file? >> >> Kind regards >> >> Hannes >> > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
I imagine somebody might have a amberallcode.js file in his or her
fork of amber. There are 100. BTW http://docs.nodejitsu.com/articles/getting-started/what-is-require On 8/29/13, H. Hirzel <[hidden email]> wrote: > Thank you, Herby. Has anybody done this following > requirejs.org/docs/optimization.html > > ? > > On 8/29/13, Herby Vojčík <[hidden email]> wrote: >> Not tried, but there is thing called require.js optimizer which does >> exactly >> this. >> >> H. Hirzel wrote: >>> Hello all >>> >>> The Amber IDE is loaded through >>> >>> <script type='text/javascript' src='support/amber.js'></script> >>> <script type='text/javascript' >>> src='support/requirejs/require.min.js'></script> >>> >>> Then amber.js pulls in a lot of small js files from the 'support' and >>> 'js' directory. >>> >>> How can I reconfigure this so that I need only one or two large file? >>> >>> Kind regards >>> >>> Hannes >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "amber-lang" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote: > I imagine somebody might have a amberallcode.js file in his or her > fork of amber. There are 100. DId you try the requirejs optimizer? I am curious how it worked / did not work / what were the problems. > BTW > http://docs.nodejitsu.com/articles/getting-started/what-is-require This explains CommonJS. It different thing than AMD. Even if both use 'require'. What was the reason to post this link (I just don't understand)? Herby -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
On 8/30/13, Herby Vojčík <[hidden email]> wrote:
> > > H. Hirzel wrote: >> I imagine somebody might have a amberallcode.js file in his or her >> fork of amber. There are 100. > > DId you try the requirejs optimizer? I am curious how it worked / did not > work / what were the problems. No, not yet. This has to wait until this or next weekend. I want to run amber off a couchdb database instance. More background on why I want this later. >> BTW >> http://docs.nodejitsu.com/articles/getting-started/what-is-require > > This explains CommonJS. It different thing than AMD. Even if both use > 'require'. Ah, I see. So amber uses the AMD Asynchronous Module Definition mechanism? > What was the reason to post this link (I just don't understand)? I am looking for background information about the module system used by amber. I like how clean the amber code is presented these days. Excellent work by you, Nicolas and the others. Regarding a amberallcode.js it seems that with the link posted earlier (how to use the require optimizer) I probably have all what I need (black box approach, no need for understanding the inner workings of the AMD mechanism). -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote: > On 8/30/13, Herby Vojčík<[hidden email]> wrote: >> This explains CommonJS. It different thing than AMD. Even if both use >> 'require'. > > Ah, I see. So amber uses the AMD Asynchronous Module Definition mechanism? Yes, it's that 'define' at the beginning of every module. >> What was the reason to post this link (I just don't understand)? > > I am looking for background information about the module system used by amber. > I like how clean the amber code is presented these days. Excellent > work by you, Nicolas and the others. Thanks. Basically, the payload of the module is the same as before. Just now it is carried by the wrapper that detaches globals (smalltalk, nil, _st) making them local (that was the first step, up to legacy3-iife tag) and subsequently using AMD as one of the proven ways to do JS modules (and thus get rid of the propriery loader in favour of existing solutions out there). -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
So far I am not terribly succesful
I have two directories amber-master and require require has r.js inside taken from http://requirejs.org/docs/download.html#rjs I have the amber-master directory as the current directory and issue amber-master\support>node ..\require\r.js -v r.js: 2.1.8, RequireJS: 2.1.8, UglifyJS2: 2.3.6, UglifyJS: 1.3.4 node ..\..\require\r.js baseUrl=. name=amber out=amber-built.js The answer is See https://github.com/jrburke/r.js for usage And that says r.js A command line tool for running JavaScript scripts that use the Asychronous Module Defintion API (AMD) for declaring and using JavaScript modules and regular JavaScript script files. It is part of the RequireJS project, and works with the RequireJS implementation of AMD. r.js is a single script that has two major functions: Run AMD-based projects in Node and Rhino. Includes the RequireJS Optimizer that combines scripts for optimal browser delivery. Does somebody have suggestions what else I can try? --Hannes On 8/30/13, Herby Vojčík <[hidden email]> wrote: > > > H. Hirzel wrote: >> On 8/30/13, Herby Vojčík<[hidden email]> wrote: >>> This explains CommonJS. It different thing than AMD. Even if both use >>> 'require'. >> >> Ah, I see. So amber uses the AMD Asynchronous Module Definition >> mechanism? > > Yes, it's that 'define' at the beginning of every module. > >>> What was the reason to post this link (I just don't understand)? >> >> I am looking for background information about the module system used by >> amber. >> I like how clean the amber code is presented these days. Excellent >> work by you, Nicolas and the others. > > Thanks. > > Basically, the payload of the module is the same as before. Just now it > is carried by the wrapper that detaches globals (smalltalk, nil, _st) > making them local (that was the first step, up to legacy3-iife tag) and > subsequently using AMD as one of the proven ways to do JS modules (and > thus get rid of the propriery loader in favour of existing solutions out > there). > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
P.S. the command lines are
C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js -v r.js: 2.1.8, RequireJS: 2.1.8, UglifyJS2: 2.3.6, UglifyJS: 1.3.4 and C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js baseUrl=. name=amber.js out=amber-built.js On 8/31/13, H. Hirzel <[hidden email]> wrote: > So far I am not terribly succesful > > I have two directories > > amber-master > and > require > > require has r.js inside taken from > http://requirejs.org/docs/download.html#rjs > > I have the > amber-master > directory as the current directory and issue > > > amber-master\support>node ..\require\r.js -v > r.js: 2.1.8, RequireJS: 2.1.8, UglifyJS2: 2.3.6, UglifyJS: 1.3.4 > > node ..\..\require\r.js baseUrl=. name=amber out=amber-built.js > > The answer is > > See https://github.com/jrburke/r.js for usage > > And that says > > r.js > > A command line tool for running JavaScript scripts that use the > Asychronous Module Defintion API (AMD) for declaring and using > JavaScript modules and regular JavaScript script files. > > It is part of the RequireJS project, and works with the RequireJS > implementation of AMD. > > r.js is a single script that has two major functions: > > Run AMD-based projects in Node and Rhino. > Includes the RequireJS Optimizer that combines scripts for optimal > browser delivery. > > > Does somebody have suggestions what else I can try? > > --Hannes > > > > > > > > > > On 8/30/13, Herby Vojčík <[hidden email]> wrote: >> >> >> H. Hirzel wrote: >>> On 8/30/13, Herby Vojčík<[hidden email]> wrote: >>>> This explains CommonJS. It different thing than AMD. Even if both use >>>> 'require'. >>> >>> Ah, I see. So amber uses the AMD Asynchronous Module Definition >>> mechanism? >> >> Yes, it's that 'define' at the beginning of every module. >> >>>> What was the reason to post this link (I just don't understand)? >>> >>> I am looking for background information about the module system used by >>> amber. >>> I like how clean the amber code is presented these days. Excellent >>> work by you, Nicolas and the others. >> >> Thanks. >> >> Basically, the payload of the module is the same as before. Just now it >> is carried by the wrapper that detaches globals (smalltalk, nil, _st) >> making them local (that was the first step, up to legacy3-iife tag) and >> subsequently using AMD as one of the proven ways to do JS modules (and >> thus get rid of the propriery loader in favour of existing solutions out >> there). >> >> -- >> You received this message because you are subscribed to the Google Groups >> "amber-lang" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote:
> P.S. the command lines are > > C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js -v > r.js: 2.1.8, RequireJS: 2.1.8, UglifyJS2: 2.3.6, UglifyJS: 1.3.4 > > and > > C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js > baseUrl=. name=amber.js out=amber-built.js I don't know how oprimizer works, but amber.js is not using any AMD modules, it just does configure AMD loader. Where is the "entry" file that actually uses the module(s), so it can start from something? Also, amber.js is _really_ browser-specific, you cannot use it with node (see how it obtains value of home, for example). You need some optimizer-specific entry file (take amber.js, copy the config from but hardcode home as '.' or something, and at the bottom put something like require(["amber/devel"], {}); ) because if nothing is require-d what should optimizer pick and concatenate? -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
On 8/31/13, Herby Vojčík <[hidden email]> wrote:
> H. Hirzel wrote: >> P.S. the command lines are >> >> C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js -v >> r.js: 2.1.8, RequireJS: 2.1.8, UglifyJS2: 2.3.6, UglifyJS: 1.3.4 >> >> and >> >> C:\Users\User\Documents\amber-master\support>node ..\..\require\r.js >> baseUrl=. name=amber.js out=amber-built.js > > I don't know how oprimizer works, but amber.js is not using any AMD modules, > it just does configure AMD loader. Where is the "entry" file that actually > uses the module(s), so it can start from something? Also, amber.js is > _really_ browser-specific, you cannot use it with node (see how it obtains > value of home, for example). > > You need some optimizer-specific entry file (take amber.js, copy the config > from but hardcode home as '.' or something, and at the bottom put something > like > > require(["amber/devel"], {}); > > ) because if nothing is require-d what should optimizer pick and > concatenate? > OK, I understand I have made a copy of amber.js and called it amberForOptimizer.js [1] You mean something like this? /* File: amberForOptimizer.js Amber package loading. Copied and adapted from amber.js Changed for requirejs optimizer, r.js Changes are marked with // *** */ // CONFIGURE AMBER var require; require = function (require) { var scripts = document.getElementsByTagName("script"); var src = scripts[ scripts.length - 1 ].src; var home = "."; // *** var config = { paths: { 'amber': home+'/support', 'amber_vm': home+'/support', 'amber_css': home+'/css', 'amber_lib': home+'/support', 'amber_core': home+'/js', 'amber_core/_source': home+'/st', 'jquery': home+'/support/jQuery/jquery-1.8.2.min', 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min' }, map: { '*': { 'css': 'amber_lib/requirejs/require-css-0.0.6/css' }, 'amber/helios': { 'jquery-ui': 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min' } }, shim: { 'jquery-ui': { deps: [ 'jquery' ] }, 'amber_lib/bootstrap/js/bootstrap': { deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ] }, 'amber_lib/CodeMirror/codemirror': { deps: [ 'css!amber_lib/CodeMirror/codemirror' ] }, 'amber_lib/jQuery/jquery.textarea': { deps: [ 'jquery', 'jquery-ui' ] }, 'amber_lib/CodeMirror/smalltalk': { deps: [ './codemirror' ] }, 'amber_lib/CodeMirror/addon/hint/show-hint': { deps: [ '../../codemirror' ] }, 'ensure-console': { exports: 'console' } } }; if (require) { require.config(config); return require; } else { return config; } }(require); // REQUIRE WHAT HAS BEEN CONFIGURED // so that r.js can optimize it. require(["amber/devel"], {}); // *** -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote: > I have made a copy of amber.js and called it amberForOptimizer.js [1] > > You mean something like this? > > > /* > File: amberForOptimizer.js > Amber package loading. > Copied and adapted from amber.js > > Changed for requirejs optimizer, r.js > > Changes are marked with // *** > > */ > > > > // CONFIGURE AMBER > > var require; > > require = function (require) { > var scripts = document.getElementsByTagName("script"); > var src = scripts[ scripts.length - 1 ].src; These two were only needed to compute home... > var home = "."; // *** > > var config = { > paths: { > 'amber': home+'/support', > 'amber_vm': home+'/support', > 'amber_css': home+'/css', > 'amber_lib': home+'/support', > 'amber_core': home+'/js', > 'amber_core/_source': home+'/st', > 'jquery': home+'/support/jQuery/jquery-1.8.2.min', > This is changed in actual version. > }, > map: { > '*': { > 'css': 'amber_lib/requirejs/require-css-0.0.6/css' > }, > 'amber/helios': { > 'jquery-ui': 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min' This is changed in actual version. > } > }, > shim: { I'm not sure how r.js will like this, I heard it does not like shim configs... but first rry with them, > 'jquery-ui': { > deps: [ 'jquery' ] > }, > 'amber_lib/bootstrap/js/bootstrap': { > deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ] > }, > 'amber_lib/CodeMirror/codemirror': { > deps: [ 'css!amber_lib/CodeMirror/codemirror' ] > }, > 'amber_lib/jQuery/jquery.textarea': { > deps: [ > }, > 'amber_lib/CodeMirror/smalltalk': { > deps: [ './codemirror' ] > }, > 'amber_lib/CodeMirror/addon/hint/show-hint': { > deps: [ '../../codemirror' ] > }, > 'ensure-console': { > exports: 'console' > } > } > }; > > if (require) { > require.config(config); > return require; > } else { > return config; > } > }(require); > > > > // REQUIRE WHAT HAS BEEN CONFIGURED > // so that r.js can optimize it. > > require(["amber/devel"], {}); // *** -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Herby
Regarding a test of the requirejs optimizer I have uploaded what I have so far to ttps://github.com/hhzl/amber/tree/requirejs-optimizer-test suggestions are welcome as allways. --Hannes ========================================================================== The setup follows the instructions on http://requirejs.org/docs/optimization.html#setup It is NOT a final setup. I.e. the optimizer call and product will finally not be in the support directory. The presence or r.js in a sibling directory of amber called 'require' is needed. http://requirejs.org/docs/download.html#rjs The branch contains two things 1) a simple non-amber example which shows that the optimizer is working and generates a result. C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts>node ../../require/r.js -o name=green out=green-built.js baseUrl=. Tracing dependencies for: green Uglifying file: C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js ---------------- C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/red.js C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/yellow.js C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green.js C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts> 2) An attempt at using the optimizer on a modified version of amber.js. C:\Users\User\Documents\amber\support>node ../../require/r.js -o name=amber out=amber-built.js baseUrl=. Tracing dependencies for: amber Error: ENOENT, no such file or directory 'C:\Users\User\Documents\amber\support\amber\deploy.js' In module tree: amber Error: Error: ENOENT, no such file or directory 'C:\Users\User\Documents\amber\support\amber\deploy.js' In module tree: amber at Object.fs.openSync (fs.js:427:18) C:\Users\User\Documents\amber\support> This is with the 'shim' in require.config unchanged. If I remove the shim completely it gives the same result. On 9/9/13, Herby Vojčík <[hidden email]> wrote: > > > H. Hirzel wrote: >> I have made a copy of amber.js and called it amberForOptimizer.js [1] >> >> You mean something like this? >> >> >> /* >> File: amberForOptimizer.js >> Amber package loading. >> Copied and adapted from amber.js >> >> Changed for requirejs optimizer, r.js >> >> Changes are marked with // *** >> >> */ >> >> >> >> // CONFIGURE AMBER >> >> var require; >> >> require = function (require) { >> var scripts = document.getElementsByTagName("script"); >> var src = scripts[ scripts.length - 1 ].src; > > These two were only needed to compute home... > >> var home = "."; // *** >> >> var config = { >> paths: { >> 'amber': home+'/support', >> 'amber_vm': home+'/support', >> 'amber_css': home+'/css', >> 'amber_lib': home+'/support', >> 'amber_core': home+'/js', >> 'amber_core/_source': home+'/st', >> 'jquery': home+'/support/jQuery/jquery-1.8.2.min', >> > 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min' > > This is changed in actual version. > >> }, >> map: { >> '*': { >> 'css': 'amber_lib/requirejs/require-css-0.0.6/css' >> }, >> 'amber/helios': { >> 'jquery-ui': >> 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min' > > This is changed in actual version. > >> } >> }, >> shim: { > > I'm not sure how r.js will like this, I heard it does not like shim > configs... but first rry with them, > >> 'jquery-ui': { >> deps: [ 'jquery' ] >> }, >> 'amber_lib/bootstrap/js/bootstrap': { >> deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ] >> }, >> 'amber_lib/CodeMirror/codemirror': { >> deps: [ 'css!amber_lib/CodeMirror/codemirror' ] >> }, >> 'amber_lib/jQuery/jquery.textarea': { >> deps: [ > 'jquery', 'jquery-ui' ] >> }, >> 'amber_lib/CodeMirror/smalltalk': { >> deps: [ './codemirror' ] >> }, >> 'amber_lib/CodeMirror/addon/hint/show-hint': { >> deps: [ '../../codemirror' ] >> }, >> 'ensure-console': { >> exports: 'console' >> } >> } >> }; >> >> if (require) { >> require.config(config); >> return require; >> } else { >> return config; >> } >> }(require); >> >> >> >> // REQUIRE WHAT HAS BEEN CONFIGURED >> // so that r.js can optimize it. >> >> require(["amber/devel"], {}); // *** > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
I will move the [amber/deploy] optimization test case to the
amber-examples project https://github.com/amber-smalltalk/amber-examples --Hannes On 9/13/13, H. Hirzel <[hidden email]> wrote: > Herby > > Regarding a test of the requirejs optimizer I have uploaded what I > have so far to > > ttps://github.com/hhzl/amber/tree/requirejs-optimizer-test > > suggestions are welcome as allways. > > --Hannes > > ========================================================================== > The setup follows the instructions on > http://requirejs.org/docs/optimization.html#setup > It is NOT a final setup. I.e. the optimizer call and product will > finally not be in the support directory. > > > The presence or r.js in a sibling directory of amber called 'require' is > needed. > http://requirejs.org/docs/download.html#rjs > > > > The branch contains two things > > 1) > a simple non-amber example which shows that the optimizer is working > and generates a result. > > C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts>node > ../../require/r.js -o name=green out=green-built.js baseUrl=. > > Tracing dependencies for: green > Uglifying file: > C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js > > C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js > ---------------- > C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/red.js > C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/yellow.js > C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green.js > > C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts> > > > > > > 2) > > An attempt at using the optimizer on a modified version of amber.js. > > C:\Users\User\Documents\amber\support>node ../../require/r.js -o > name=amber out=amber-built.js baseUrl=. > > Tracing dependencies for: amber > Error: ENOENT, no such file or directory > 'C:\Users\User\Documents\amber\support\amber\deploy.js' > In module tree: > amber > > Error: Error: ENOENT, no such file or directory > 'C:\Users\User\Documents\amber\support\amber\deploy.js' > In module tree: > amber > > at Object.fs.openSync (fs.js:427:18) > > C:\Users\User\Documents\amber\support> > > > This is with the 'shim' in require.config unchanged. If I remove the > shim completely it gives the same result. > > On 9/9/13, Herby Vojčík <[hidden email]> wrote: >> >> >> H. Hirzel wrote: >>> I have made a copy of amber.js and called it amberForOptimizer.js [1] >>> >>> You mean something like this? >>> >>> >>> /* >>> File: amberForOptimizer.js >>> Amber package loading. >>> Copied and adapted from amber.js >>> >>> Changed for requirejs optimizer, r.js >>> >>> Changes are marked with // *** >>> >>> */ >>> >>> >>> >>> // CONFIGURE AMBER >>> >>> var require; >>> >>> require = function (require) { >>> var scripts = document.getElementsByTagName("script"); >>> var src = scripts[ scripts.length - 1 ].src; >> >> These two were only needed to compute home... >> >>> var home = "."; // *** >>> >>> var config = { >>> paths: { >>> 'amber': home+'/support', >>> 'amber_vm': home+'/support', >>> 'amber_css': home+'/css', >>> 'amber_lib': home+'/support', >>> 'amber_core': home+'/js', >>> 'amber_core/_source': home+'/st', >>> 'jquery': home+'/support/jQuery/jquery-1.8.2.min', >>> >> 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min' >> >> This is changed in actual version. >> >>> }, >>> map: { >>> '*': { >>> 'css': 'amber_lib/requirejs/require-css-0.0.6/css' >>> }, >>> 'amber/helios': { >>> 'jquery-ui': >>> 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min' >> >> This is changed in actual version. >> >>> } >>> }, >>> shim: { >> >> I'm not sure how r.js will like this, I heard it does not like shim >> configs... but first rry with them, >> >>> 'jquery-ui': { >>> deps: [ 'jquery' ] >>> }, >>> 'amber_lib/bootstrap/js/bootstrap': { >>> deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ] >>> }, >>> 'amber_lib/CodeMirror/codemirror': { >>> deps: [ 'css!amber_lib/CodeMirror/codemirror' ] >>> }, >>> 'amber_lib/jQuery/jquery.textarea': { >>> deps: [ >> 'jquery', 'jquery-ui' ] >>> }, >>> 'amber_lib/CodeMirror/smalltalk': { >>> deps: [ './codemirror' ] >>> }, >>> 'amber_lib/CodeMirror/addon/hint/show-hint': { >>> deps: [ '../../codemirror' ] >>> }, >>> 'ensure-console': { >>> exports: 'console' >>> } >>> } >>> }; >>> >>> if (require) { >>> require.config(config); >>> return require; >>> } else { >>> return config; >>> } >>> }(require); >>> >>> >>> >>> // REQUIRE WHAT HAS BEEN CONFIGURED >>> // so that r.js can optimize it. >>> >>> require(["amber/devel"], {}); // *** >> >> -- >> You received this message because you are subscribed to the Google Groups >> "amber-lang" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
A working requirejs optimizer example which generates a
bin\amber-deploy-for-browser.js is here The script requirejs-optimizer does the job. An open issue I am currently working on: How do I connect the generated code to an application class call that actually gets executed? For example smalltalk.Welcome._new()._begin(); Comments are welcome. --Hannes Appendices - Log file - List of changes to current master --------------------------------------------------------------------------------------------------------------- C:\Users\User\Documents\amber>node ../require/r.js -o requirejs-optimizer-build-config.js Tracing dependencies for: amber/amber Uglifying file: C:/Users/User/Documents/amber/bin/amber-deploy-for-browser.js C:/Users/User/Documents/amber/bin/amber-deploy-for-browser.js ---------------- C:/Users/User/Documents/amber/support/ensure-console.js C:/Users/User/Documents/amber/support/es5-shim-2.0.2/es5-shim.min.js C:/Users/User/Documents/amber/support/es5-shim-2.0.2/es5-sham.min.js C:/Users/User/Documents/amber/support/browser-compatibility.js C:/Users/User/Documents/amber/support/boot.js C:/Users/User/Documents/amber/support/smalltalk.js C:/Users/User/Documents/amber/support/helpers.js C:/Users/User/Documents/amber/support/jQuery/jquery-1.8.2.min.js C:/Users/User/Documents/amber/support/nil.js C:/Users/User/Documents/amber/support/_st.js C:/Users/User/Documents/amber/js/Kernel-Objects.js C:/Users/User/Documents/amber/js/Kernel-Classes.js C:/Users/User/Documents/amber/js/Kernel-Methods.js C:/Users/User/Documents/amber/js/Kernel-Collections.js C:/Users/User/Documents/amber/js/Kernel-Infrastructure.js C:/Users/User/Documents/amber/js/Kernel-Exceptions.js C:/Users/User/Documents/amber/js/Kernel-Transcript.js C:/Users/User/Documents/amber/js/Kernel-Announcements.js C:/Users/User/Documents/amber/js/Canvas.js C:/Users/User/Documents/amber/support/deploy.js C:/Users/User/Documents/amber/support/amber.js C:\Users\User\Documents\amber> ------------------------------------------------------------------------------------- Changes to current master https://github.com/amber-smalltalk/amber/commit/931b270849b09011b0f5a31bcd1e797853a7513f A. // the following was added to suppor/amber.js at the end of the file require( ["amber/deploy"], function (smalltalk) { smalltalk.defaultAmdNamespace = "amber_core"; smalltalk.initialize(); // smalltalk.Welcome._new()._begin(); return smalltalk; } ); B. file: requirejs-optimizer in amber directory node ../require/r.js -o requirejs-optimizer-build-config.js C. File: requirejs-optimizer-build-config in amber directory ({ baseUrl: ".", paths: { "amber": "./support", 'amber_vm': './support', 'amber_css': './css', 'amber_lib': './support', 'amber_core': './js', 'amber_core/_source': './st', 'amber_html': ".", 'jquery': './support/jQuery/jquery-1.8.2.min', 'jquery-ui': './support/jQuery/jquery-ui-1.8.24.custom.min' }, name: "amber/amber", out: "bin/amber-deploy-for-browser.js" }) --------------------------------------------------------------------------------------- Prerequisite is r.js (= the requirejs optimizer, conventionally known as "linker") r.js is from http://requirejs.org/docs/release/2.1.8/r.js copied into a sibling directory of amber called 'require'. On 9/14/13, H. Hirzel <[hidden email]> wrote: > I will move the [amber/deploy] optimization test case to the > amber-examples project > > https://github.com/amber-smalltalk/amber-examples > > --Hannes > > > On 9/13/13, H. Hirzel <[hidden email]> wrote: >> Herby >> >> Regarding a test of the requirejs optimizer I have uploaded what I >> have so far to >> >> ttps://github.com/hhzl/amber/tree/requirejs-optimizer-test >> >> suggestions are welcome as allways. >> >> --Hannes >> >> ========================================================================== >> The setup follows the instructions on >> http://requirejs.org/docs/optimization.html#setup >> It is NOT a final setup. I.e. the optimizer call and product will >> finally not be in the support directory. >> >> >> The presence or r.js in a sibling directory of amber called 'require' is >> needed. >> http://requirejs.org/docs/download.html#rjs >> >> >> >> The branch contains two things >> >> 1) >> a simple non-amber example which shows that the optimizer is working >> and generates a result. >> >> C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts>node >> ../../require/r.js -o name=green out=green-built.js baseUrl=. >> >> Tracing dependencies for: green >> Uglifying file: >> C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js >> >> C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green-built.js >> ---------------- >> C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/red.js >> C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/yellow.js >> C:/Users/User/Documents/amber/requirejs-optimizer-test-scripts/green.js >> >> C:\Users\User\Documents\amber\requirejs-optimizer-test-scripts> >> >> >> >> >> >> 2) >> >> An attempt at using the optimizer on a modified version of amber.js. >> >> C:\Users\User\Documents\amber\support>node ../../require/r.js -o >> name=amber out=amber-built.js baseUrl=. >> >> Tracing dependencies for: amber >> Error: ENOENT, no such file or directory >> 'C:\Users\User\Documents\amber\support\amber\deploy.js' >> In module tree: >> amber >> >> Error: Error: ENOENT, no such file or directory >> 'C:\Users\User\Documents\amber\support\amber\deploy.js' >> In module tree: >> amber >> >> at Object.fs.openSync (fs.js:427:18) >> >> C:\Users\User\Documents\amber\support> >> >> >> This is with the 'shim' in require.config unchanged. If I remove the >> shim completely it gives the same result. >> >> On 9/9/13, Herby Vojčík <[hidden email]> wrote: >>> >>> >>> H. Hirzel wrote: >>>> I have made a copy of amber.js and called it amberForOptimizer.js [1] >>>> >>>> You mean something like this? >>>> >>>> >>>> /* >>>> File: amberForOptimizer.js >>>> Amber package loading. >>>> Copied and adapted from amber.js >>>> >>>> Changed for requirejs optimizer, r.js >>>> >>>> Changes are marked with // *** >>>> >>>> */ >>>> >>>> >>>> >>>> // CONFIGURE AMBER >>>> >>>> var require; >>>> >>>> require = function (require) { >>>> var scripts = document.getElementsByTagName("script"); >>>> var src = scripts[ scripts.length - 1 ].src; >>> >>> These two were only needed to compute home... >>> >>>> var home = "."; // *** >>>> >>>> var config = { >>>> paths: { >>>> 'amber': home+'/support', >>>> 'amber_vm': home+'/support', >>>> 'amber_css': home+'/css', >>>> 'amber_lib': home+'/support', >>>> 'amber_core': home+'/js', >>>> 'amber_core/_source': home+'/st', >>>> 'jquery': home+'/support/jQuery/jquery-1.8.2.min', >>>> >>> 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min' >>> >>> This is changed in actual version. >>> >>>> }, >>>> map: { >>>> '*': { >>>> 'css': 'amber_lib/requirejs/require-css-0.0.6/css' >>>> }, >>>> 'amber/helios': { >>>> 'jquery-ui': >>>> 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min' >>> >>> This is changed in actual version. >>> >>>> } >>>> }, >>>> shim: { >>> >>> I'm not sure how r.js will like this, I heard it does not like shim >>> configs... but first rry with them, >>> >>>> 'jquery-ui': { >>>> deps: [ 'jquery' ] >>>> }, >>>> 'amber_lib/bootstrap/js/bootstrap': { >>>> deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ] >>>> }, >>>> 'amber_lib/CodeMirror/codemirror': { >>>> deps: [ 'css!amber_lib/CodeMirror/codemirror' ] >>>> }, >>>> 'amber_lib/jQuery/jquery.textarea': { >>>> deps: [ >>> 'jquery', 'jquery-ui' ] >>>> }, >>>> 'amber_lib/CodeMirror/smalltalk': { >>>> deps: [ './codemirror' ] >>>> }, >>>> 'amber_lib/CodeMirror/addon/hint/show-hint': { >>>> deps: [ '../../codemirror' ] >>>> }, >>>> 'ensure-console': { >>>> exports: 'console' >>>> } >>>> } >>>> }; >>>> >>>> if (require) { >>>> require.config(config); >>>> return require; >>>> } else { >>>> return config; >>>> } >>>> }(require); >>>> >>>> >>>> >>>> // REQUIRE WHAT HAS BEEN CONFIGURED >>>> // so that r.js can optimize it. >>>> >>>> require(["amber/devel"], {}); // *** >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups >>> "amber-lang" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an >>> email to [hidden email]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote: > A working requirejs optimizer example which generates a > > bin\amber-deploy-for-browser.js > > is here > > The script > requirejs-optimizer > does the job. > > An open issue I am currently working on: > > How do I connect the generated code to an application class call that > actually gets executed? For example > smalltalk.Welcome._new()._begin(); It should work as-is, if you load require.js in <script> first, and the generated file in <script> after it (instead of amber.js). Then you should have the same <script> with mapping and require call as in non-optimized case. Herby -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Yes, indeed, it works
https://github.com/hhzl/amber/blob/optimizer1c/indexDeploy.html (below) Next step is to do it in a non-core package. <!DOCTYPE html> <html> <head> <title>Amber Smalltalk</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Hannes Hirzel"/> <script type='text/javascript' src='support/requirejs/require.min.js'></script> <script type='text/javascript' src='bin/amber-deploy-for-browser.js'></script> </head> <body> <script type='text/javascript'> require( ["amber/devel"], function (smalltalk) { smalltalk.defaultAmdNamespace = "amber_core"; smalltalk.initialize(); smalltalk.Welcome._new()._begin(); } ); </script> </body> </html> On 9/16/13, Herby Vojčík <[hidden email]> wrote: > > > H. Hirzel wrote: >> A working requirejs optimizer example which generates a >> >> bin\amber-deploy-for-browser.js >> >> is here >> >> The script >> requirejs-optimizer >> does the job. >> >> An open issue I am currently working on: >> >> How do I connect the generated code to an application class call that >> actually gets executed? For example >> smalltalk.Welcome._new()._begin(); > > It should work as-is, if you load require.js in <script> first, and the > generated file in <script> after it (instead of amber.js). > > Then you should have the same <script> with mapping and require call as in > non-optimized case. > > Herby > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
H. Hirzel wrote: > Yes, indeed, it works > > https://github.com/hhzl/amber/blob/optimizer1c/indexDeploy.html > (below) > > Next step is to do it in a non-core package. > > > <!DOCTYPE html> > <html> > > <head> > <title>Amber Smalltalk</title> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/> > <meta name="author" content="Hannes Hirzel"/> > <script type='text/javascript' > src='support/requirejs/require.min.js'></script> > <script type='text/javascript' > src='bin/amber-deploy-for-browser.js'></script> > > </head> > > <body> > <script type='text/javascript'> > require( > ["amber/devel"], I am interested in doing it little differently, namely, not to change amber.js up there, but include "amber/devel-packed" instead "amber/devel" here. That is why I see them as siblings of amber subsets. For this, I would like to see if simple define is possible instead of require as the "starter code" at the bottom. C ould you try how r.js optimizer perform if instead of 'require(["amber/devel"], ...)' type of code as starter code at the bottom you would have just a simple define(["amber/devel"], function (x) { return x }); If it produces concatenated file, it would be great. If that file would be called, say, devel-packed.js and put as a sibling to devel.js, this more AMDish way of loading optimized files could work). > function (smalltalk) { > smalltalk.defaultAmdNamespace = "amber_core"; > smalltalk.initialize(); > > smalltalk.Welcome._new()._begin(); > } > ); > </script> > </body> > </html> Herby -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Ok, I understand and do it. Let's move the discussion of this email
thread to the 'all in one` issue on github. On 9/16/13, Herby Vojčík <[hidden email]> wrote: > > > H. Hirzel wrote: >> Yes, indeed, it works >> >> https://github.com/hhzl/amber/blob/optimizer1c/indexDeploy.html >> (below) >> >> Next step is to do it in a non-core package. >> >> >> <!DOCTYPE html> >> <html> >> >> <head> >> <title>Amber Smalltalk</title> >> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> >> <meta name="author" content="Hannes Hirzel"/> >> <script type='text/javascript' >> src='support/requirejs/require.min.js'></script> >> <script type='text/javascript' >> src='bin/amber-deploy-for-browser.js'></script> >> >> </head> >> >> <body> >> <script type='text/javascript'> >> require( >> ["amber/devel"], > > I am interested in doing it little differently, namely, not to change > amber.js up there, but include "amber/devel-packed" instead "amber/devel" > here. That is why I see them as siblings of amber subsets. > > For this, I would like to see if simple define is possible instead of > require as the "starter code" at the bottom. > > C > ould you try how r.js optimizer perform if instead of > 'require(["amber/devel"], ...)' type of code as starter code at the bottom > you would have just a simple > > define(["amber/devel"], function (x) { return x }); > > If it produces concatenated file, it would be great. If that file would be > called, say, devel-packed.js and put as a sibling to devel.js, this more > AMDish way of loading optimized files could work). > >> function (smalltalk) { >> smalltalk.defaultAmdNamespace = "amber_core"; >> smalltalk.initialize(); >> >> smalltalk.Welcome._new()._begin(); >> } >> ); >> </script> >> </body> >> </html> > > Herby > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Free forum by Nabble | Edit this page |