requirejs+build.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>Editor</title>
  7. <style type="text/css" media="screen">
  8. body {
  9. overflow: hidden;
  10. }
  11. #editor {
  12. margin: 0;
  13. position: absolute;
  14. top: 0;
  15. bottom: 0;
  16. left: 0;
  17. right: 0;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <pre id="editor">function foo(items) {
  23. var i;
  24. for (i = 0; i &lt; items.length; i++) {
  25. alert("Ace Rocks " + items[i]);
  26. }
  27. }</pre>
  28. <script src="../demo/kitchen-sink/require.js"></script>
  29. <script>
  30. require.config({paths: {ace: "../src"}})
  31. define('testace', ['ace/ace'],
  32. function(ace, langtools) {
  33. console.log("This is the testace module");
  34. var editor = ace.edit("editor");
  35. editor.setTheme("ace/theme/twilight");
  36. editor.session.setMode("ace/mode/javascript");
  37. require(["ace/requirejs/text!src/ace"], function(e){
  38. editor.setValue(e);
  39. })
  40. }
  41. );
  42. require(['testace'])
  43. </script>
  44. </body>
  45. </html>