tkellen / requirejs-library-skeleton

RequireJS / Jasmine / r.js / almond skeleton for javascript libraries and modules.
MIT License
85 stars 12 forks source link

Configure skeleton with jquery #7

Closed angeloh closed 11 years ago

angeloh commented 11 years ago

I am new to grunt and requirejs. I change build.js and add jquery to path:

  paths: {
       "cs": "../vendor/cs",
       "coffee-script": "../vendor/coffee-script",
       "spec": "../test/spec",
       "jquery": "../vendor/jquery"
   },

add jquery.js to vendor/jquery.js

change lib/skeleton.js to define(['require', 'jquery'], function (require, $) {

However, I got this following error when run 'grunt'.

      $ grunt
         Running "jasmine:all" (jasmine) task
         Running specs for runner.html

         <WARN> PhantomJS timed out, possibly due to an unfinished async spec. Use --force to continue. </WARN>

         Aborted due to warnings.

What can I fix this to have jquery dependency?

tkellen commented 11 years ago

You need to update runner.html and runner-node.js path configurations with jquery also. Currently, they don't pull in the values of build.js automatically.

The latest version of grunt-contrib-jasmine handles this properly but I won't be updating this repo until grunt 0.4 is released.

Also, this is just my personal preference, but I would require jquery like this:

define(function(require) {
  var $ = require('jquery');
  var skeleton = require('skeleton/core');
  skeleton.feature = require('skeleton/feature');
  skeleton.module = require('skeleton/module');
  skeleton.coffeescript = require('cs!skeleton/coffeescript');
  return skeleton;
});
angeloh commented 11 years ago

It works for me. Thanks!