From 75c68a0dad02f62de4c72f452ac7d36bb792989d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Wed, 29 Oct 2014 15:47:28 -0300 Subject: [PATCH] New build that does not include jQuery This is useful when you already have jQuery loaded in your page, for example on a Wordpress site. --- Gruntfile.js | 2 ++ src/build-no-jquery.js | 28 ++++++++++++++++++++++++++++ src/jquery-external.js | 3 +++ src/jquery-private-external.js | 3 +++ 4 files changed, 36 insertions(+) create mode 100644 src/build-no-jquery.js create mode 100644 src/jquery-external.js create mode 100644 src/jquery-private-external.js diff --git a/Gruntfile.js b/Gruntfile.js index 956f3ba31..79c7bbc6b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -100,6 +100,8 @@ module.exports = function(grunt) { }; exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' + './node_modules/requirejs/bin/r.js -o src/build.js optimize=none out=builds/converse.js && ' + + './node_modules/requirejs/bin/r.js -o src/build-no-jquery.js &&' + + './node_modules/requirejs/bin/r.js -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' + './node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' + './node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' + './node_modules/requirejs/bin/r.js -o src/build-no-otr.js &&' + diff --git a/src/build-no-jquery.js b/src/build-no-jquery.js new file mode 100644 index 000000000..157159d72 --- /dev/null +++ b/src/build-no-jquery.js @@ -0,0 +1,28 @@ +({ + baseUrl: "../", + name: "components/almond/almond.js", + out: "../builds/converse.nojquery.min.js", + include: ['main'], + tpl: { + // Use Mustache style syntax for variable interpolation + templateSettings: { + evaluate : /\{\[([\s\S]+?)\]\}/g, + interpolate : /\{\{([\s\S]+?)\}\}/g + } + }, + map: { + // '*' means all modules will get 'jquery-private' + // for their 'jquery' dependency. + '*': { 'jquery': 'jquery-private' }, + // 'jquery-private' wants the real jQuery module + // though. If this line was not here, there would + // be an unresolvable cyclic dependency. + 'jquery-private': { 'jquery': 'jquery' } + }, + mainConfigFile: '../main.js', + paths: { + "converse-dependencies": "src/deps-full", + "jquery": "src/jquery-external", + "jquery-private": "src/jquery-private-external", + } +}) diff --git a/src/jquery-external.js b/src/jquery-external.js new file mode 100644 index 000000000..035c02fa7 --- /dev/null +++ b/src/jquery-external.js @@ -0,0 +1,3 @@ +define('jquery', [], function () { + return jQuery; +}); diff --git a/src/jquery-private-external.js b/src/jquery-private-external.js new file mode 100644 index 000000000..058025463 --- /dev/null +++ b/src/jquery-private-external.js @@ -0,0 +1,3 @@ +define(['jquery'], function (jq) { + return jq; +});