Permalink
Browse files

readme

  • Loading branch information...
0 parents commit e32ad30b4c25a3ce95b30c60315f57487263d2f7 @jasonmcaffee committed Dec 12, 2011
@@ -0,0 +1,3 @@
+*.class
+*.pyc
+*.pyo
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>requireMultipleVersionsOfJquery</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.aptana.projects.webnature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,52 @@
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Requirejs oriented project structure</title>
+
+ <!-- Load the script "js/main.js" as our entry point, along with requirejs -->
+ <script data-main="js/main" src="js/libs/require/require.js"></script>
+
+ </head>
+ <body>
+
+ <section>
+
+ <h1>Requirejs with multiple versions of jquery demo</h1>
+
+ <article>
+ <p>
+ Just a simple demonstration showing a module declaring 2 versions of jquery as dependencies.
+ </p>
+ <p>
+ The code that is executing is:
+ </p>
+ <div>
+ //demonstrate loading 2 versions of jquery into a module <br/>
+ require([ <br/>
+ 'libs/jquery/jquery1.7.1.module', //we can use this shortcut now that it was established in main.js <br/>
+ 'libs/jquery/jquery1.6.3.module' <br/>
+ ], <br/>
+ function($171, $163){<br/>
+ alert('I have jquery version : ' + $171.fn.jquery + ' and jquery version : ' + $163.fn.jquery + ' successfully loaded.'); <br/>
+ });<br/>
+ </div>
+ </article>
+
+ </section>
+
+ </body>
+
+ <script type="text/javascript">
+
+ //demonstrate loading 2 versions of jquery into a module
+ require([
+ 'libs/jquery/jquery1.7.1.module', //can't use the shortcut defined in main.js for some reason. have to use full path...
+ 'libs/jquery/jquery1.6.3.module'
+ ],
+ function($171, $163){
+ alert('I have jquery version : ' + $171.fn.jquery + ' and jquery version : ' + $163.fn.jquery + ' successfully loaded.');
+ });
+
+ </script>
+</html>
@@ -0,0 +1 @@
+Simple demonstration using requirejs to load 2 isolated versions of jquery.
@@ -0,0 +1,17 @@
+/**
+ * @author Jason McAffee
+ * Application initialization occurs here.
+ *
+ */
+
+define([
+ ],
+ function(){
+ var initialize = function(){
+
+ }
+
+ return {
+ initialize: initialize
+ };
+ });

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,13 @@
+/**
+ * @author Jason McAffee
+ * wrap jquery to expose it as a module so that it can be loaded like any other AMD module
+ */
+
+define([
+ // Load the original jQuery source file
+ 'order!libs/jquery/jquery1.6.3.min'
+ ],
+ function(){
+ // Tell Require.js that this module returns a reference to jQuery
+ return $;
+ });

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,14 @@
+/**
+ * @author Jason McAffee
+ * wrap jquery to expose it as a module so that it can be loaded like any other AMD module
+ *
+ */
+
+define([
+ // Load the original jQuery source file
+ 'order!libs/jquery/jquery1.7.1.min'
+ ],
+ function(){
+ // Tell Require.js that this module returns a reference to jQuery
+ return $;
+ });

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,23 @@
+/**
+ * @author Jason McAffee
+ * bootstrap requirejs
+ */
+
+// Require.js allows us to configure shortcut alias
+require.config({
+ paths: {
+ jquery171module: 'libs/jquery/jquery1.7.1.module',
+ jquery163module: 'libs/jquery/jquery1.6.3.module'
+ }
+
+});
+
+require([
+
+ // Load our app module and pass it to our definition function
+ 'app'
+], function(App){
+ // The "app" dependency is passed in as "App"
+ // Again, the other dependencies passed in are not "AMD" therefore don't pass a parameter to this function
+ App.initialize();
+});

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit e32ad30

Please sign in to comment.