GithubHelp home page GithubHelp logo

requirejs / require-jquery Goto Github PK

View Code? Open in Web Editor NEW
261.0 261.0 97.0 1.31 MB

A RequireJS+jQuery sample project

Home Page: http://requirejs.org

License: Other

Shell 0.88% JavaScript 98.63% HTML 0.49%

require-jquery's Introduction

RequireJS

RequireJS loads plain JavaScript files as well as more defined modules. It is optimized for in-browser use, including in a Web Worker, but it can be used in other JavaScript environments, like Rhino and Node. It implements the Asynchronous Module API.

RequireJS uses plain script tags to load modules/files, so it should allow for easy debugging. It can be used simply to load existing JavaScript files, so you can add it to your existing project without having to re-write your JavaScript files.

RequireJS includes an optimization tool you can run as part of your packaging steps for deploying your code. The optimization tool can combine and minify your JavaScript files to allow for better performance.

If the JavaScript file defines a JavaScript module via define(), then there are other benefits RequireJS can offer: improvements over traditional CommonJS modules and loading multiple versions of a module in a page. RequireJS also has a plugin system that supports features like i18n string bundles, and text file dependencies.

RequireJS does not have any dependencies on a JavaScript framework.

RequireJS works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+.

Latest Release

License

MIT

Code of Conduct

jQuery Foundation Code of Conduct.

Directories

  • dist: Scripts and assets to generate the requirejs.org docs, and for generating a require.js release.
  • docs: The raw HTML files for the requirejs.org docs. Only includes the body of each page. Files in dist are used to generate a complete HTML page.
  • tests: Tests for require.js.
  • testBaseUrl.js: A file used in the tests inside tests. Purposely placed outside the tests directory for testing paths that go outside a baseUrl.
  • updatesubs.sh: Updates projects that depend on require.js Assumes the projects are siblings to this directory and have specific names. Useful to copy require.js to dependent projects easily while in development.

Tests

This repo assumes some other repos are checked out as siblings to this repo:

git clone https://github.com/requirejs/text.git
git clone https://github.com/requirejs/i18n.git
git clone https://github.com/requirejs/domReady.git
git clone https://github.com/requirejs/requirejs.git

So when the above clones are done, the directory structure should look like:

  • domReady
  • i18n
  • text
  • requirejs (this repo)

You will need to be connected to the internet because the JSONP and remoteUrls tests access the internet to complete their tests.

Serve the directory with these 4 siblings from a web server. It can be a local web server.

Open requirejs/tests/index.html in all the browsers, click the arrow button to run all the tests.

require-jquery's People

Contributors

buley avatar joshed-io avatar jrburke avatar slexaxton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

require-jquery's Issues

[enhancement] Add missing bower.json.

Hey, maintainer(s) of jrburke/require-jquery!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library jrburke/require-jquery is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "jrburke/require-jquery",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

License for cdnjs

HI
We would like to update license of you hosted library on cdnjs host.
We found here that licence is CC0-1.0, however, in you code it is looks like "Available via the MIT or new BSD license."
So, what exact license is you library
Thanks

cc cdnjs/cdnjs#11847

Upgrade to jQuery 1.6.1

Hi,

now that jquery-1.6.1 is more compatoble with 1.5 than it was, is there any chance of getting an updated build of require-jquery? I had a look at doing the work myself, but a nextTick error from trying to run 'dist.sh' even on a virgin checkout.

Thanks!

Pete

r.js 1.0.4 overwrites main.js

original title: requirejs.org sample jquery-require project contains r.js v1.0.3.

v1.0.3 overwrites the main.js file as described in: http://groups.google.com/group/requirejs/browse_thread/thread/b177d7cd98ab8290

i see the repo has just been updated to 1.0.4 so i'm sure it'll be updated soon:)

thanks!

UPDATE: it still happens with 1.0.4.
it seems it was a problem in my configuration:

myproject/main.js
myproject/build.js

build.js:

({
  appDir: '../myproject/',
  baseDir: '.'
  dir: '../myproject-build'
})

I guess internally r.js resolved the location of the optimized main.js to the original main.js file in myproject/ 

Opinion appreciated...

Some background:
I am undertaking writing an declarative based MVC library. The approach I've taken for structuring the library is quite similar in manner to how jQuery builds its own object, but I use IEFs instead of one huge file and at the end I have one IEF that checks for define and if it exists it uses it to define an AMD module by returning the global object. I'm at the point where my MVC's controllers, routers history/push state are all reliably working and I am eating my own dog food, so to speak, and using the library to build a web site to promote the library and to document how to use its declarative api. As models, views and 2-way binding are implemented these too will be eaten to develop the site.

While building the website using my MVC library along with Require.js I believe I've learned a few things about Require.js that seems to invalidate a lot of what has been written about it, most specifically being that when using define([...], function(...){}) you 'have to' return a value. In fact, most of the defines that I've written are along the lines of the following:

define(["common","coccyx"], function(common, Coccyx) {
    "use strict";

    var showIndexPage = function(){
        // Render the index page which is purely static, no dynamic
        // content at all, so no need to use any kind of templating.
        var html = this.$("#index-page").html(),
            common = Coccyx.userspace.common;
        common.setMenuItemActive("/");
        this.$("#content").html(html);
    };

    Coccyx.controllers.registerController({
        name: "",
        routes: {
            "/": showIndexPage
        }
    });
});

In the above module, which is a user defined module, it registers a controller with a single route, and both of the method calls, common.setMenuItemActive and Coccyx.controllers.registerControlle are made to the coccyx MVC module, via the Coccyx parameter. The module itself, though, returns nothing! The actual routing is handled by coccyx internally, searching for registered routes that match the current url, and if found, call the provided callback method. I opted to design the library this way, forgoing classes and object hierarchies, because I believe using plain-jane objects and composition makes it easy for users to define controllers and routes, as well as all the other aspects of an MVC architecture as opposed to some of the common and popular MVC libraries today which tend to favor pseudo classical inheritance; my shameful opinion, of course :).

The callback method defined in the require method itself is trivial as in:
Coccyx.history.start(true);

and that's all that is needed to render the first page of a website using coccyx.

Sorry for the long intro and finally, here's my question: Using Require.js in the way I am has me feeling I am being edgy. Am I using Require.js completely wrong? Am I on the edge and about to fall off into the abyss? Like I said, everything is working. I am not bleeding globals, only one, just like jQuery does. I've used Require.js off and on now for the last 2 years but quite honestly, this approach I've taken to build a platform for others to be able to easily compose and register objects scares even me! But I do love what I have so far and I'd love it even more if others will also be able to benefit by it and hence the MIT licensing as I currently plan for it.

I wouldn't blame you for totally ignoring this and dumping it into the trash altogether. But honestly, I am hoping you feel charitable and will give me your feedback.

Sincerely.
Jeff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.