From 1c0e6d1a550de8f08e425c9d73b7fcc29695d18a Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Tue, 14 Apr 2015 18:31:06 -0300 Subject: [PATCH 1/3] README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f152ab4..49f77e9 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Raconteur is still in active development towards its 1.0 release. Raconteur can be added as a dependency to a package.json file and installed from git. Or, you can use the [scaffold](http://github.com/sequitur/raconteur-scaffold). -Raconteur itself doesn't contain any command-line tools or anything that needs to be installed globally. You just need `npm` and `gulp` to be working on your system. +Raconteur itself doesn't contain any command-line tools or anything that needs to be installed globally. You just need `npm` to be working on your system. Raconteur is a set of CommonJS modules designed to work with Browserify and a build system like Grunt or Gulp. ## Code examples From 5d4e3c2f1906e83b164c7fc1aec69049159dccf2 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Wed, 15 Apr 2015 00:58:07 -0300 Subject: [PATCH 2/3] Use exportUndum() --- devel/js/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devel/js/main.js b/devel/js/main.js index d3ec2bc..3b99d3c 100644 --- a/devel/js/main.js +++ b/devel/js/main.js @@ -1,10 +1,11 @@ var situation = require('raconteur/situation.js'), $ = require('jquery'), - undum = require('undum-commonjs'), oneOf = require('raconteur/oneOf.js'), elements = require('raconteur/elements.js'), qualities = require('raconteur/qualities.js'); +situation.exportUndum(); + var a = elements.a, span = elements.span; From b18f46cbae6112fe7d4a329f9a4434c6111c79ce Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Wed, 15 Apr 2015 01:06:49 -0300 Subject: [PATCH 3/3] Document exportUndum() --- docs/index.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index b8b3213..9f9e30f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,19 +8,28 @@ Since Raconteur began its life as a library for writing Undum stories using Coff ## A Note on the Undum API and CommonJS -Raconteur uses a modified version of Undum that complies with CommonJS practices: undum-commonjs. What this means is that, instead of exporting an API directly, Undum now works like a [Node.js] module. In practice, what this means is that instead of the global `undum` object that you had in vanilla undum, you now have to explicitly `require` it. Similarly, we are now using a CommonJS version of JQuery instead of loading JQuery separately in our html file: +Ideally, Raconteur is supposed to use a commonjs-compliant version of Undum that can be instantiated with `require()ยด. In actuality, pending a rewrite of Undum's codebase, Raconteur and Undum rely on a single, global Undum object. For this reason, currently the interface to import Undum in your project is: ```coffeescript -undum = require('undum-commonjs') -$ = require('jquery') +situation = require('raconteur/lib/situation.js') +situation.exportUndum() ``` ```javascript -var undum = require('undum-commonjs'), - $ = require('jquery'); +var situation = require('raconteur/lib/situation.js'); +situation.exportUndum(); ``` -Using `$` as the name of the JQuery object is a convention and not mandatory. Similarly, `undum` can be anything. +This will ensure that there is a global Undum object and that it is the same as Raconteur's. This is a hack; expect this API to change... eventually. + +JQuery is also used as a CommonJS module, so if you intend to call JQuery directly in your story, you'll need to require it: + +```coffeescript +$ = require('jquery'); +``` +```javascript +var $ = require('jquery'); +``` ## Raconteur Modules