Code Monkey home page Code Monkey logo

requirejs-rails's Introduction

RequireJS for Rails

Integrates RequireJS into the Rails 3+ Asset Pipeline.

UPGRADE NOTES: Users upgrading within the 0.x series should read the Changes section for relevant usage changes. We're pushing hard to 1.0, when the configuration and setup details will be declared stable. Until that time expect some bumps as things bake out.

Usage

  1. Add this to your Rails app's Gemfile:

    gem 'requirejs-rails'
    
  2. Remove all Sprockets directives such as //= require jquery from application.js and elsewhere. Instead establish JavaScript dependencies using AMD-style define() and require() calls.

  3. Use requirejs_include_tag at the top-level of your app's layout(s). Other modules will be pulled in dynamically by require.js in development and for production builds optimized by r.js. Here's a basic app/views/layouts/application.html.erb modified for requirejs-rails:

    <!DOCTYPE html>
    <html>
    <head>
      <title>Frobnitz Online</title>
      <%= stylesheet_link_tag   "application" %>
      <%= requirejs_include_tag "application" %>
      <%= csrf_meta_tags %>
      <meta charset="utf-8">
    </head>
    <body>
    
    <%= yield %>
    
    </body>
    </html>
  4. Organize your JavaScript or CoffeeScript code into modules using define():

    # app/assets/javascripts/views/tweet_view.js.coffee
    
    define ['backbone'], (Backbone) ->
      class TweetView extends Backbone.View
        # ...
  5. Instantiate your app using require() from a top-level module such as application.js:

    # app/assets/javascripts/application.js.coffee
    
    require ['jquery', 'backbone', 'TheApp'], ($, Backbone, TheApp) ->
    
      # Start up the app once the DOM is ready
      $ ->
        window.App = new TheApp()
        Backbone.history.start
          pushState: true
        window.App.start()
  6. When ready, build your assets for production deployment as usual. requirejs-rails defaults to a single-file build of application.js. Additional modules and r.js layered builds may be specified via config/requirejs.yml; see the Configuration section below.

    rake assets:precompile

Configuration

The Basics

Configuration lives in config/requirejs.yml. These values are inspected and used by requirejs-rails and passed along as configuration for require.js and r.js. The default configuration declares application.js as the sole top-level module. This can be overridden by creating a config/requirejs.yml, such as:

modules:
  - name: 'mytoplevel'

You may pass in require.js config options as needed. For example, to add path parameters:

paths:
  d3: "d3/d3"
  "d3.time": "d3/d3.time"

Layered builds

Only modules specified in the configuration will be created as build artifacts by r.js. Layered r.js builds be configured like so:

modules:
  - name: 'appcommon'
  - name: 'page1'
    exclude: ['appcommon']
  - name: 'page2'
    exclude: ['appcommon']
priority: ['appcommon']

In this example, only modules page1 and page2 are intended for direct loading via requirejs_include_tag. The appcommon module contains dependencies shared by the per-page modules. As a guideline, each module in the configuration should be referenced by one of:

  • A requirejs_include_tag in a template
  • Pulled in via a dynamic require() call. Modules which are solely referenced by a dynamic require() call (i.e. a call not optimized by r.js) must be specified in the modules section in order to produce a correct build.
  • Be a common library module like appcommon, listed in the priority config option.

Almond support

This gem supports single-file builds with almond. Use the following setting in application.rb to enable it:

config.requirejs.loader = :almond

Almond builds have the restriction that there must be exactly one modules entry in requirejs.yml. Typically the wrap option will be used to create a self-contained build:

modules:
  - name: 'main'
wrap: true

Build-time asset filter

The requirejs-rails build process uses the Asset Pipeline to assemble assets for the r.js build. By default, assets ending in .js, .html, and .txt will be made available to the build. If you have other asset suffixes to include, use the logical_path_patterns config setting to add them.

For example, if your templates all end in .templ like so...

// in app/assets/javascripts/myapp.js
define(function (require) {
  var stuff = require('text!stuff.templ');
  // ...
});

... then this config setting will ensure they're picked up in the build:

# in config/application.rb
config.requirejs.logical_path_patterns += [/\.templ$/]

Advanced features

Additional data attributes

requirejs_include_tag accepts an optional block which should return a hash. This hash will be used to populate additional data-... attributes like so:

<%= requirejs_include_tag "page1" do |controller|
      { 'foo' => controller.foo,
        'bar' => controller.bar
      }
    end
%>

This will generate a script tag like so:

<script data-main="/assets/page1.js" data-foo="..." data-bar="..." src="/assets/require.js"></script>

External domain (CDN) support

There are two ways in which requirejs-rails supports the use of different domains for serving built JavaScript modules, as is the case when using a CDN.

  1. URLs in paths config in requirejs.yml:

    If requirejs-rails encounters an URL as the right-hand side of a paths configuration, it will correctly emit that as "empty:" during the build process so that r.js will do the right thing.

    Example:

    paths:
      jquery: "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
  2. Deploying all requirejs-rails assets to a CDN:

    In config/environments/production.rb (or another environment) set the run_config as follows:

    config.requirejs.run_config['baseUrl'] = 'http://mycdn.example.com/12345abc/assets'

    The asset_sync gem is one tool that can be used to deploy your built assets to a CDN (S3, in this case).

Troubleshooting

Avoid config.assets.precompile

Don't set config.assets.precompile to reference any of your AMD module code. Avoid it altogether, except to reference non-AMD code that you're loading via javascript_include_tag, and which is never referenced by the AMD codebase.

Using AMD libraries

I currently recommend placing your AMD libraries into vendor/assets/javascripts. The needs of a few specific libraries are discussed below.

jQuery

jQuery users must use jQuery 1.7 or later (jquery-rails >= 1.0.17) to use it as an AMD module with RequireJS. To use jQuery in a module:

# app/assets/javascripts/hello.js

define ['jquery'], ($) ->
  (id) ->
    $(id).append('<div>hello!</div>')

Backbone.js

Backbone 0.9.x doesn't support AMD natively. I recommend the amdjs fork of Backbone which adds AMD support and actively tracks mainline.

Underscore.js

Underscore 1.3.x likewise doesn't have AMD support. Again, see the amdjs fork of Underscore.

0.x API Changes

Usage changes that may break functionality for those upgrading along the 0.x series are documented here. See the Changelog for the full list of feature additions, bugfixes, etc.

v0.9.2

  • Support for Rails 4.

v0.9.0

  • The upgrade to RequireJS and r.js 2.0 includes changes that will break some apps.

v0.5.1

  • requirejs_include_tag now generates a data-main attribute if given an argument, ala:

    <%= requirejs_include_tag "application" %>

    This usage is preferred to using a separate javascript_include_tag, which will produce errors from require.js or r.js if the included script uses define anonymously, or not at all.

v0.5.0

  • application.js is configured as the default top-level module for r.js builds.
  • It is no longer necessary or desirable to specify baseUrl explicitly in the configuration.
  • Users should migrate application configuration previously in application.js (ala require.config(...)) to config/requirejs.yml

TODOs

Please check out our GitHub issues page to see what's upcoming and to file feature requests and bug reports.


Copyright 2011-2014 John Whitley. See the file MIT-LICENSE for terms.

requirejs-rails's People

Contributors

agis avatar andyjeffries avatar arehberg avatar arlm avatar billmag avatar carsomyr avatar flrngel avatar gcirne avatar gurdotan avatar hollow avatar jae avatar jankeesvw avatar jezstephens avatar jonhyman avatar justinlove avatar juwalter avatar jwhitley avatar karellm avatar koenpunt avatar leppert avatar mdkalish avatar rakoth avatar remybach avatar rricard avatar sun16 avatar swils avatar trevoke avatar wuservices avatar yxmatic avatar zeppelin 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

requirejs-rails's Issues

Support precompilation via r.js

We want to support precompilation via RequireJS' r.js.

My current thoughts are to add a rake task (possibly triggered by rake assets:precompile) to manage this.

It's an open question how (or even whether) we'll integrate with Sprockets. If Sprockets continues to handle CoffeeScript conversion, that would allow a convenient workaround for the unfortunate limitation on named modules in cs.js.

Only one requirejs_include_tag allowed per page - why?

I woud like to use require.js so that users don't need to load all assets when they visit my landing/home page. This must be pretty small and fast.

There is a logged-in mode with more assets/modules that needs to be pushed along with base. Why can't I do so?

<%= requirejs_include_tag 'base' %>
<% if logged_in? %>
  <%= requirejs_include_tag 'logged-in' %>
<% end %>

btw, base and logged-in may have shared modules.

Perhaps, I misunderstand Require.js or requirejs-rails itself so please help

Deps for requirejs config option ignored.

If I declare a deps array in my requirejs.yml file it is completely ignored when the site is loaded. This is a valid option for a requirejs config file and according to require js this would load the defined dependencies for the site when require is referenced.

Module digests should represent aggregated contents

Each module built by r.js should have a digest that represents its aggregated contents, similar to how Sprockets works. This either implies recreating Sprockets' digest logic, or else integrating the r.js build as a Sprockets compressor. The latter is probably the better approach; see issue #9 for investigation of that approach.

Undefined method for requirejs_include_tag

I'm working on a Rails (3.2.2), and since adding requirejs-rails to my project, I've been getting errors like:

undefined method `requirejs_include_tag' for #<#<Class:0xcc90390>:0xcef59f0>

I can post my Gemfile and requirejs.yml on request, but this error seems to be a problem in the Gem itself.

I have tried both requireing it in my views, and includeing it in my ApplicationHelper, to no avail.

Any help is appreciated.

Node throws error (Unexpected number) on compilation

Hi !
It's been a few hours I'm fighting with the r.js compilation (note : that works on heroku, but other errors are thrown anyway !).
Every time I'm trying to compile ... I get this (with --trace argument) :

** Invoke assets:precompile (first_time)
** Invoke requirejs:precompile:external (first_time)
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:external
/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/bin/ruby /usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke requirejs:precompile:all (first_time)
** Invoke requirejs:precompile:prepare_source (first_time)
** Invoke requirejs:setup (first_time)
** Invoke assets:environment (first_time)
** Invoke requirejs:precompile:disable_js_compressor (first_time)
** Execute requirejs:precompile:disable_js_compressor
** Execute assets:environment
** Execute requirejs:setup
** Invoke requirejs:clean (first_time)
** Invoke requirejs:setup 
** Execute requirejs:clean
** Execute requirejs:precompile:prepare_source
** Invoke requirejs:precompile:generate_rjs_driver (first_time)
** Invoke requirejs:setup 
** Execute requirejs:precompile:generate_rjs_driver
** Invoke requirejs:precompile:run_rjs (first_time)
** Invoke requirejs:setup 
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:run_rjs

/Users/rricard/Repos
nv/0.3.0/version
      ^^

module.js:437
  var compiledWrapper = runInThisContext(wrapper, filename, true);
                        ^
SyntaxError: Unexpected number
    at Module._compile (module.js:437:25)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:315:13)
rake aborted!
Asset compilation with node failed.

I tried with three different node versions (0.6.21, 0.8.4 and 0.9.0). I don't think it comes from my code (for the moment, it's just as simple as the samples) but from somewhere else I don't know (maybe node considering that I'm using the n version manager).
I tried to use the r.js command directly but it does not play nice with the rails directory structure.
If you have any idea or help to give me : first, to debug this (I'm ok with pure ruby or pure node debugging but this ...) and if you have more time, to locate and patch with me (if it's a bug) this error.

Anyway, thank you for the awesome plugin !
I'll continue to investigate ... !

EDIT : I think I found it by following the node stack trace ! I added in the rake task in your gem a line which is supposed to print the temporary rjs driver :

print `cat #{requirejs.config.driver_path}`

And ... surprise ! the path to the driver is incomplete ! I had a space in one of my parent directories that wasn't escaped well ! I'll give you a patch soon !

Dealing with RequireJS depedencies

Hey,

So I'm having a little problem regarding this plugin and the asset pipeline. The thing is, for some reason it's not precompiling dependencies I set on the requireJS 'deps' array.

Here's a gist for my application.js file (that gets called in the requirejs helper): https://gist.github.com/2633020

In production, the app doesn't load that 'app/main' file because, well, it should be in application.js. The main.js file looks like this: https://gist.github.com/2633063 (basically the same thing from the backbone boilerplate project)

Following that line of thought, I pulled all code from that app/main.js file and put it in my that application.js file, and now the nodejs compiler from requirejs is bugging: http://cl.ly/3X2m1i1T3V1V3v2N053L

By the way: everything works in development.

Anyone care to shed some light on this? I'm using Rails 3.2.2 and Ruby 1.9.3.

Thanks

EDIT: Ok so that last error was printing because for some random reason I needed to copy jquery.js and use.js to the main folder instead of leaving them at libs/ and plugins/ respectively.
Now the error is much scarier: http://cl.ly/2o06341c3C0f3N2Z2604

Add a sanity-test Rails app

Either update the default plugin dummy Rails app to become a barebones sanity-test app, or add a dedicated app for that purpose.

How are files compiled?

I have a frontend.js as a "front controller". It is a module that requires main dependencies (Backbone, Underscore, jQuery...) and do some initializations and then I load the app. Here is a simplified version:

require([
  'jquery',
], function($, Underscore, UnderscoreString, Backbone) {

  $(function() {

    // Some initializations

    require([
      'modules/layout/main',
      'modules/fields/main',
      'modules/forms/main',
    ], function() {
      console.log('app loaded');
    });

  });
});

It works perfectly in dev but in production after I precompiled my assets, I get the following error: /assets/modules/forms/main.js Failed to load resource: the server responded with a status of 404 (Not Found). Do you know what is happening? Do I actually need to declare the three libraries loading from the inner require as modules in my config/requirejs.yml?

Support a one-file build

This issue is a prerequisite to #2. We should be able to inline require.js into the top-level module, ala:

{
  name: "require"
  inline: "application"
  out: "/path/to/output/application.js"
}

Right now the build setup assumes that require.js must be built independently, and we actually allow Sprockets to handle that.

Proposal:

If the user config specifies a module "require", then require.js should be inlined. Don't emit a separately built require.js file.

Outdated r.js / uglify.js, minifying jQuery 1.8 fails

Iโ€™ve got a strange minification error when trying to use jQuery 1.8. Minimal setup:

application.js.coffee:

require ['jquery'], ->

requirejs.yml:

paths:
  jquery: 'jquery-1.8.0'

With unminified jquery-1.8.0.js in vendor/assets/javascripts.

When I compile the assets, the jQuery code isnโ€™t minified correctly. Thereโ€™s a named function expression in jQuery:

(function add( args ) {
    jQuery.each( args, function( _, arg ) {
        if ( jQuery.isFunction( arg ) && ( !options.unique || !self.has( arg ) ) ) {
            list.push( arg );
        } else if ( arg && arg.length ) {
            // Inspect recursively
            add( arg );
        }
    });
})( arguments );

The built-in r.js with the built-in UglifyJS compiles this to:

(function e(args){jQuery.each(args,function(_,arg){jQuery.isFunction(arg)&&(!options.unique||!self.has(arg))?list.push(arg):arg&&arg.length&&add(arg)})})(arguments)

The problem is the mismatch between e and add. e is the mangled function name, but itโ€™s called using original name add. This throws an exception.

The bug does not appear when

  • Building a sample project with r.js 2.0.6 on the command line
  • optimize: 'none' in requirejs.yml, then minifying the output manually with uglifyjs 1.3.3 on the command line
  • Replacing bin/r.js in the gem code with r.js 2.0.6

In short, I think the cause of the problem is just the outdated r.js with comes with requirejs-rails. Would you mind to update it?

Until then Iโ€™m just using jQuery 1.7.2 again. jQuery doesnโ€™t have a named function expression there.

Thanks!

Problem with config.asstes.precompile()

Hey there,

i hope this problem only depends on my configuration. I need to setup some extra files within application.rb:

For example -> config.assets.precompile += %w( rails.js admin/admin.css )

The admin/admin.css gets precompiled but the rails.js not. If i add it to the requirejs.yml it works. Because of its nature as none-module it would be nice to still use the appication.rb for this.

Anyone else the same problem?

Sascha

Modules get loaded but won't execute, when using precompiled assets on staging and prod

I am having an annoying issue Rails 3.2.3.

The project is set up to use the assets pipeline for some files, and RequireJS is setup separately to handle modules. In the dev environment, when the assets are not precompiled, everything works just fine.

Unfortunately in staging and production the modules won't work anymore.

After rake assets:precompile I can see all the modules precompiled, ready to go, and loaded in the browser when I hit the page, but non of the juice the module should do works.

Below I included the code I am using to access my module:

The generated RequireJS source:

<script>var require = {"baseUrl":"/assets","paths":{"page1":"/assets/page1-65007fcb586328f4b0570112e901e236","page2":"/assets/page2-891433d4b4762054226ef1724113a8c3","page3":"/assets/page3-33a86932722c914917d6baa7edcc3f97"}};</script>
<script data-main="/assets/page1-65007fcb586328f4b0570112e901e236" src="/assets/require-0b4496496bdeb7cbd09f2e710baec25e.js"></script>

The contents of page1.js file:

console.log('before page1 module');
define([],
function () {
  console.log('page1 module');
});
console.log('after page1 module');

After hitting the page the console output looks like this:

before page1 module 
after page1 module 

There is no errors in the console whatsoever.

Any help would be much appreciated!

Assets folder alias issue

I am trying to "selectively" get the js files into requirejs.

they are located in the assets/javascripts/lib
and assets/javascripts/lib/dependencies

here is my require.yml config

paths:
 underscore: 'lib/dependencies/underscore'
 backbone: 'lib/dependencies/backbone'
 marionette: 'lib/dependencies/backbone.marionette'
 geppetto: 'lib/geppetto'

however, they are not compiled in the production mode. While they are served OK in the dev mode.

If I add the following

modules:
 - name: 'lib/dependencies/underscore'
 - name: 'lib/dependencies/backbone'
 - name: 'lib/dependencies/backbone.marionette'
 - name: 'lib/geppetto

They are compiled, but the require variable on the page is strange:

 <script>var require = {"baseUrl":"/assets","paths":    {"lib/dependencies/underscore":"/assets/lib/dependencies/underscore-cd950c5d26d0c0defb3d54c85769f625", "lib/dependencies/backbone":"/assets/lib/dependencies/backbone-03a32fd5270318872a932da63d361a01", "lib/dependencies/backbone.marionette":"/assets/lib/dependencies/backbone.marionette-54697121ad976f6559ed8915ba24a8ef","lib/geppetto":"/assets/lib/geppetto-2eae748edc4f2248f77bf93db95daf8e"}};</script>
  <script  src="/assets/require-52c77a71cdb25defabf0e084426dcf2f.js"></script>

I want to preserve the original alias, e.g. like this;

underscore: '/assets/lib/dependencies/underscore-cd950c5d26d0c0defb3d54c85769f625'

and not

"lib/dependencies/underscore":"/assets/lib/dependencies/underscore-cd950c5d26d0c0defb3d54c85769f625"

Any ideas what's going wrong?

Emit warning/error if baseUrl specified in config

I'm trying to use require.js with rails 3.2 on heroku. I'm having difficulty because the precompilation step is failing on heroku, it is also failing locally with the following error:

Error: ERROR: module path does not exist: /assets/lookup.js for module named: lookup

Currently I have an application called lookup.js and my app/assets/javascripts dir looks like this:

app/assets/javascripts/
โ”œโ”€โ”€ lookup.js
โ”œโ”€โ”€ models
โ”‚ย ย  โ””โ”€โ”€ car.js
โ””โ”€โ”€ views
    โ””โ”€โ”€ car_details_view.js

And in my requirejs.yml looks like this

modules:
  - name: lookup
baseUrl: /assets
paths:
  models: models
  views: views

Any ideas what I'm doing wrong?

Require / Underscore / Backbone

I'm a newbie, so I may have this wrong... please forgive me if that's the case. I am getting an error trying to require "underscore" and "backbone" using this gem.

The error I'm receiving (when i require ['jquery','underscore','backbone']) is the following:
f is undefined
[Break On This Error] this._escapedAttributes={};this.cid=f....tes[a])return b;b=this.attributes[a];
backbone.js (line 8)

  • I've added "gem 'requirejs-rails'" to my projects Gemfile.
  • I've run "bundle install" "rake db:migrate"... not sure if both are required?
  • I removed all Sprockets directives from application.js as directed.
  • In application.html.erb I replaced with "<%= requirejs_include_tag "application" %>"
  • Added scripts as follows:

app/assets/javascripts/

  • application.js

vender/assets/javascripts/

  • backbone.js
  • underscore.js
  • jquery-1.7.1.min.js
  • application.js has the following code:
    require(['jquery', 'underscore', 'backbone'], function($, _, Backbone) {
    console.log('app init');
    });

Any help is much appreciated!!

-Greg

Hashed assets

One of the biggest challenges to using require.js with the asset pipeline is hashed asset file names.

Because of this, file names are unpredictable until "late in game".

Any way this gem could address those dynamic file names in a beautiful way?

Heroku precompile assets Fails

I'm using requirejs-rails and asset_sync (asset_sync works good before i use requirejs).

When i try to deploy to heroku i had this error:

  Compiled jquery.min.js  (1ms)  (pid 1459)
   Compiled coffee-script.js  (1ms)  (pid 1459)
   node.js:134
   throw e; // process.nextTick error, or 'error' event on first tick
   ^
   Error: Error: ERROR: module path does not exist: /tmp/build_2961hwmu8bqhh/tmp/assets/application.js for module named: application. Path is relative to: /tmp/build_2961hwmu8bqhh
   at /tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14281:31
   at /tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14166:23
   at /tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15358:30
   at Object.execCb (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1773:33)
   at Object.check (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1083:51)
   at Object.enable (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1324:22)
   at Object.init (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:982:26)
   at Object.require (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1579:28)
   at /tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1857:24
   at Function.optimize (/tmp/build_2961hwmu8bqhh/vendor/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15368:13)
   at /tmp/build_2961hwmu8bqhh/tmp/rjs_driver.js:33:15
   rake aborted!
   Asset compilation with node failed.
   Tasks: TOP => requirejs:precompile:all => requirejs:precompile:run_rjs
   (See full trace by running task with --trace)
   rake aborted!
   Command failed with status (1): [/tmp/build_2961hwmu8bqhh/vendor/ruby-1.9.3...]
   Tasks: TOP => assets:precompile => requirejs:precompile:external
   (See full trace by running task with --trace)
   Precompiling assets failed, enabling runtime asset compilation

Any ida how to fix this?

config.assets.compile should be overridden to always be true during precompile

While precompiling assets in requirejs-rails_tasks.rake, Rails.application.config.assets.compile should be set to true during the compilation. This allows hashes to be calculated for any nested pipeline assets that won't be compiled until after requirejs compilation has finished.

I encountered this particular issue when referencing a font file via the assets pipeline within a CSS file that was packaged for use with the requirejs text plugin. Because the standard compilation of assets happens after the requirejs compilation, the font hash hadn't yet been generated and the compilation would fail.

Javascript is precompiled, but rails thinks it isn't

I've got a AMD file "app.js" working with requirejs-rails which works fine on development, but I'm having problems once I move into environments with precompilation. When attempting to load the app, I receive the message: app isn't precompiled for the following code:

27:     <%= javascript_include_tag "templates" %>
28:     <%= requirejs_include_tag "app" %>

But app.js is definitely precompiled in public/assets.

I have a config/requirejs.yml of

modules: 
  - name: 'app'
wrap: true

App.js is the only file listed in publics/assets/rjs_manifest.yml. App.js is NOT listed in public/assets/manifest.yml, and adding it doesn't change the error.

requirejs-rails with catch all routes

I have a catch all route in my Rails app that is used to redirect all requests to my Backbone.js app, the route is set up like so:

match '*path' => 'dashboard#index'

However, my main module isn't actually loading with this setup in production. The script tag that is generated by the require.js script is:

<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="/assets/manage-995e287579d75911f4ff97528f0d000f" src="/assets/manage-995e287579d75911f4ff97528f0d000f"></script>

This is grabbed by my catch all route and thus does not return the required JS (in production only - this works fine in development). I've been looking into this and I found this with Sprockets: rails/rails#436

Is this a config issue on my end? If the script tag above had .js appended to it then everything would be fine, however in development it doesn't have .js appended to it. This leads me to believe that when the assets are actually precompiled and served from public/assets the catch all route seems to be interfering with the way that the assets are handled without .js.

I would be happy to provide any other information that would help with this!

Automated testing of production behavior

A significant portion of correct behavior of this gem is only exhibited in a production deployment; the development and test environments don't have any coverage here. Important questions include:

  • Does the r.js build process work correctly?
  • Does the helper work in production mode?
  • Does the helper use digest-fingerprinted asset names?

and so forth. To date, this sort of testing has been handled by ad-hoc testing on a production-mode dummy Rails app.

This issue covers the following:

  • Creation of a testprod environment whose settings trigger the use of digest-signed optimized assets, identical to a production deployment.
  • A rake test:prod task that utilizes this environment and which performs an asset build.
  • Tests and/or test suites tailored towards running in this environment.

Support use.js

I need to be sure that jquery is loaded for jquery_ujs to work properly. I'm using the configuration below:

modules: 
  - name: 'application' 
paths: 
  use: "use" 
use: 
  jquery_ujs: 
    deps: ["jquery"] 

However, I just get the following error:

Uncaught TypeError: Module 'jquery_ujs' is undefined or does not have a use config. Make sure it exists, add a use config, or don't use use! on it

requirejs-rails has a whitelist that looks like this which filters out the use configuration:

  self.run_config_whitelist = %w{ 
        baseUrl 
        callback 
        catchError 
        context 
        deps 
        jQuery 
        locale 
        packages 
        paths 
        priority 
        scriptType 
        urlArgs 
        waitSeconds 
        xhtml 
      } 

Since use.js is very useful for loading javascript that does not natively support AMD I propose that we include use in the list and add some documentation in the readme on how to use it.

requirejs_include doesn't work with subdirectories

Something like

requirejs_include "backbone/main"

gives an error that it can't find path/to/assets/main.js instead of /path/to/assets/backbone/main.js. Is this a bug? The file to be compiled is located at app/assets/javascripts/backbone/main.js.coffee.

Consider validation for config/requirejs.yml

At some point, it might be nice to have simple validation of config/requirejs.yml. I'm thinking this would be limited to known key names and their top-level types. E.g. if paths is nil-valued, that's an error.

Any runtime costs and errors thrown should only occur in development and at build time (e.g. in the rake task) by default, with the usual per-environment configuration.

A tool worth investigating towards this end is Kwalify, an engine that uses a schema (itself in YAML) to validate a YAML file such as config/requirejs.yml.

Also, it's worth considering whether/how this all fits in with the runtime (require.js) and build-time (r.js) key whitelists.

no method error encountered when running with a Rails Engine

I have not tested this in environments other than the application I am working on. The Application is a Rails app with engine containing most model/controller/helper definitions, having requirejs-rails defined as a runtime dependency of the engine gemspec. The result is the following when attempting to call requirejs_include_tag in the layout. Environment is Rails 3.2.2

undefined method `requirejs_include_tag' for #<#Class:0x007fa90a528a18:0x007fa90ef79a90>

Unable to serve text! template assets except via the /public folder

Javascript templates saved in a folder such as /app/assets/templates/ cannot be served because there is no route for that server.

How to best serve templates seems like a feature request that require(designDecision). From an efficiency point of view, I would say that a template should always be served with the javascript that is going to use it. Firing off an extra ajax request to get a template file looks like the simple solution, but is less than idea.

I'm a big fan of the approach Jammit took with javascript. it would minify the templates and serve them as one template per line of javascript like so:

(function () {
  window.JST = window.JST || {};
  window.JST["account/dialog"] = _.template('<table border="0" cellspacing="0" cellpadding="0"><tbody id="account_list_content"></tbody></table>');
  window.JST["common/menu"] = _.template('<% var mid = id ? id + "_content" : \'\'; %><div class="menu_content interface <%= standalone ? \'standalone\' : \'attached\' %>" id="<%= mid %>"><div class="menu_items"></div></div>');
  window.JST["common/menubutton"] = _.template('<div class="wrapper"><div class="label"><%= label %></div></div><div class="corner"></div>');
  window.JST["common/tooltip"] = _.template('<div id="tooltip_title"></div><div id="tooltip_text"></div>');
})();

If I remember correctly, if a different template engine other than JResig's micro templates, which is included with underscore, it would inline the template parser in the module.

Packaging the templates in layered approach could be interesting. For example, all the templates for the admin area could be one template package that returns an object with one template per Object property.

These could be defined like so:

define([
  'underscore',  //  This could be the templating engine of choice, such as Handlebars or Mustache.
  'text!templates/common/menu',
  'text!templates/common/menubutton',
  'text!templates/common/tooltip'
], function(_, menu, menubutton, tooltip) {

  var commonTemplates = {
    menu: _.template(menu),
    menubutton: _.template(menubutton),
    tooltip: _.template(tooltip);
  };

  return commonTemplates;
});

... and would compiled down to something like so:

define([
  'underscore',
  'text!templates/common/menu',
  'text!templates/common/menubutton',
  'text!templates/common/tooltip'
], function(_, menu, menubutton, tooltip) {

  var commonTemplates = {
    menu: _.template('<% var mid = id ? id + "_content" : \'\'; %><div class="menu_content interface <%= standalone ? \'standalone\' : \'attached\' %>" id="<%= mid %>"><div class="menu_items"></div></div>'),
    menubutton: _.template('<div class="wrapper"><div class="label"><%= label %></div></div><div class="corner"></div>'),
    tooltip: _.template('<div id="tooltip_title"></div><div id="tooltip_text"></div>');
  };

  return commonTemplates;
});

... and be used like so:

define([
  'jquery',
  'underscore',
  'backbone',
  'templates/common'
], function($, _, Backbone, commonTemplates) {

  var Menu = Backbone.View.extend({

    initialize: function() {
      _.bindAll(this);
    },

    render: function() {
      var t = commonTemplates.menu;
      var context = { id : 'abc123', standalone : false, mid : 'edf456' };
      $(this.el).html(t(context)); 
      return this;
    }
  });

  return Menu;
});

Could not find file 'require', Rails 3.1.2

Hey,

I tried to use requirejs-rails in a new Rails 3.1.2 project, but the provided application.js content leads to this error when loading application.js in a browser:

Uncaught Error: Sprockets::FileNotFound: couldn't find file 'require'

All I did was following the provided guide, namely Step #1, and Step #2.
Am I missing something?

Paths config fallback unsupported

I just wanted to implement something that already works in dev mode :
Combining multiple sources, just in case a CDN is unavailable !
It looks like that when done in requirejs.yml :

paths:
  zepto:
    - 'http://cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min'
    - zepto
  jquery:
    - 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min'
    - jquery

But this feature is not available when compilation is done !
Instead I get a node crash that looks like that :

Error: Error: ENOENT, no such file or directory '/.../tmp/assets/http:/cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min,zepto.js'
    at Object.fs.openSync (fs.js:338:18)

    at build (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14166:23)
    at requirejs.optimize.runBuild (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15358:30)
    at Object.context.execCb (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1773:33)
    at Object.Module.check (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1083:51)
    at Object.Module.enable (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1324:22)
    at Object.Module.init (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:982:26)
    at Object.context.require (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1579:28)
    at requirejs (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1857:24)
    at Function.requirejs.optimize (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15368:13)
    at /.../tmp/rjs_driver.js:48:15
rake aborted!
Asset compilation with node failed.

I don't know how to exclude paths from the compilation, I've tried to manipulate the helper around line 50 with that :

# Add paths for assets specified by full URL (on a CDN)
            run_config['paths'].each do |name, path|
              if path =~ /^https?:/
                paths[name] = path
              elsif path.kind_of?(Array)
                for sub_path in path
                  paths[name] = path if path =~ /^https?:/
                end
              end
            end

But it does nothing .... I don't understand clearly how r.js works so I'm just walking around the project by searching terms like CDN or path ... I'll go read some documentation about r.js tomorrow but in the meantime, if you have any clue, I'd like to see it !

rake assets:precompile issue

Hello,

Following the directions outlined in ReadMe, I am encountering the following issues. Any help is much appreciated. :)

1.It does not appear that config/requirejs.yml does not exist after adding to gemfile and running bundle. Am I missing something? Maybe I add that manually; thought it was auto-generated?

  1. when running "rake assets:precompile" the rake is aborted and am presented the following message:

    rake aborted!
    You have a nil object when you didn't expect it!
    You might have expected an instance of Array.
    The error occurred while evaluating nil.+
    Tasks: TOP => assets:precompile => requirejs:precompile:stage1 => requirejs:precompile:generate_rjs_driver

Thanks in advance.

-Ben

Rails 3.2.0 upgrade

Is anyone aware of any upgrade issues to the latest version of rails?
This gem is currently fixed to rails 3.1. Is there anything preventing an update?

middleman

middleman use sprocket for building. Is compatible this gem with middleman?

Support multiple config files

I've a project where I wanna build 4 different versions of my app, one for iPhone / iPad and german/english. All should use the same boot.js:

requirejs(['app', [i18n]], function(app, i18n) {
 app.start(i18n);
});

For every version I've set the path to app and i18n to the specific iphone/ipad german/english version.

So, as requirejs' optimizer don't support multiple modules with the same name I've build a small node task that creates the config files dynamically. As we switch to requirejs-rails, we have the same problem as before.

So is there a way to have multiple config files for requirejs-rails?

Anonymous Mismatched define() Module error with v0.5.0

I saw that you chose to have two javascript includes to include require.js and the app instead of using the RequireJS API approach:

e.g.

<%= requirejs_include_tag %>
<%= javascript_include_tag "application" %>

vs.

<%= requirejs_include_tag 'application' %>

AFAICT, because of this approach, I am getting an anonymous mismatched define() module error:
http://requirejs.org/docs/errors.html#mismatch

"Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them."

Was there any reason to avoid the "data-main" attribute defined in the require.js docs?

Using the gem along with the existing assets pipeline

I used require.js to develop a single-page app which I'm trying to integrate with an existing rails project. The aim is to provide a page that serves this app.

Obviously, since the rails project is already working as it should, I don't want to interfere with the current assets pipeline. From what I can tell, this gem replaces the sprocket pipeline for javascript files. Is it possible to use this gem so I can use require.js with just one page, leaving the rest of the project's js as it is, or should I just try to use require.js with the default assets pipeline, without this gem?

undefined method error with <= requirejs_include_tag %> in v0.5

NameError in Meetings#show

Showing /Users/andrewdeandrade/code/improvisu/app/views/layouts/_meeting_layout.html.erb where line #29 raised:

undefined local variable or method `requirejs_include_tag' for #<#Class:0x007f8de8f0c490:0x007f8de8f0fa00>

Extracted source (around line #29):

26:
27:
28: <%= javascript_include_tag 'modernizr-2.0.6.js' %>
29: <%= requirejs_include_tag %>
30: <%= javascript_include_tag "mobile_app" %>
31: <%= csrf_meta_tag %>
32:

Support for RequireJS config functions

UPDATE: As indicated in other issues, it's now clear that a switch to a Javascript configuration is the way forward. The original writeup is retained below for historical purposes.


requirejs-rails up through this writing (v0.9.1) manages the low-level require.js configuration for the user to automate integration with the Rails asset pipeline. The current strategy is that user configuration is specified in config/requirejs.yml, which is trivially readable in ruby code. The final configuration is modified and emitted as JSON as needed during development and build time.

Unfortunately, this approach isn't compatible with various config options. E.g. using the init option in a shim config, requires a user-provided function. Even a JSON parser isn't sufficient to handle such cases, since function syntax requires a full Javascript parser.

So the question arises: how should this be handled? Options include:

Extend requirejs.yml with an "include" syntax

Use YAML object syntax to create a "passthru" type. It accepts a string which is emitted unchanged into the configuration, allowing for arbitrary Javascript code.

  • Pros: this preserves backward-compatibility for existing configurations.
  • Cons: emitting code becomes tricky, as the JSON emitter probably won't do the job anymore.

Switch to a Javascript configuration

This would introduce a javascript configuration file instead of YAML. It would require a full Javascript parser such as RKelly . Configuration handling will be somewhat complicated as the gem will have to deal with a parse tree vs. a mundane YAML-y data structure.

  • Pros: This will handle more complex RequireJS configurations.
  • Cons: More complicated implementation. Not backward compatible. Compatibility issues could be mitigated by adding a deprecation warning and accepting both YAML and JS configuration files for a limited number of pre-1.0 releases.

Other impacts

As several other issues have illustrated, at least some very basic config validation is needed. The gem currently bombs badly if the YAML is malformed in various ways and could provide much better user feedback than the current obscure exception backtraces.

CDN conflict?

I have both requirejs and regular rails assets hosted on s3, and i have both these defined in production.rb:

config.requirejs.run_config['baseUrl']
config.action_controller.asset_host

What i am observing is that for requirejs to run the asset_host line needs to be commented out, but then that leaves out the regular rails assets. Anyone faced anything similar? or am i missing something?

Krishna

Deploying to production Results in Module loading not complete?

After adding requirejs-rails to an app of mine in production I get this error. NodeJS is installed and all the required modules are in their proper places.

The weird thing is everything works fine during development.

The only thing I can think of is I'm already using application.js for non-backbone stuff so I've got my requirejs files in app/assets/javascripts/bb/, and the requirejs load file is at app/assets/floor_plan.js

 ** [out :: inurse.com] /usr/bin/ruby /usr/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
 ** [out :: inurse.com] 
 ** [out :: inurse.com] /home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14166
 ** [out :: inurse.com] throw new Error(errorMsg);
 ** [out :: inurse.com] ^
 ** [out :: inurse.com] Error: Error: Module loading did not complete for: jquery
 ** [out :: inurse.com] at Function.build.traceDependencies (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15117:19)
 ** [out :: inurse.com] 
 ** [out :: inurse.com] at build (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14166:23)
 ** [out :: inurse.com] at requirejs.optimize.runBuild (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15358:30)
 ** [out :: inurse.com] at Object.context.execCb (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1773:33)
 ** [out :: inurse.com] at Object.Module.check (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1083:51)
 ** [out :: inurse.com] at Object.Module.enable (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1324:22)
 ** [out :: inurse.com] at Object.Module.init (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:982:26)
 ** [out :: inurse.com] at Object.context.require (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1579:28)
 ** [out :: inurse.com] at requirejs (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1857:24)
 ** [out :: inurse.com] at Function.requirejs.optimize (/home/deployment/regapp_deployment/shared/bundle/ruby/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15368:13)
 ** [out :: inurse.com] at /home/deployment/regapp_deployment/releases/20120808145627/tmp/rjs_driver.js:49:15
 ** [out :: inurse.com] rake aborted!
 ** [out :: inurse.com] Asset compilation with node failed.
 ** [out :: inurse.com] 
 ** [out :: inurse.com] Tasks: TOP => requirejs:precompile:all => requirejs:precompile:run_rjs
 ** [out :: inurse.com] (See full trace by running task with --trace)
 ** [out :: inurse.com] rake aborted!
 ** [out :: inurse.com] Command failed with status (1): [/usr/bin/ruby /usr/bin/rake requirejs:prec...]
 ** [out :: inurse.com] 
 ** [out :: inurse.com] Tasks: TOP => assets:precompile => requirejs:precompile:external
 ** [out :: inurse.com] (See full trace by running task with --trace)
    command finished in 23399ms

baseUrl should be overridable in some rare cases

On my system we're running under a torquebox setup which requires that we have a subdirectory url structure like: http://localhost:8080/subsystem_beta

I understand that this is a small case but I was wondering why baseUrl was specifically noted as something we aren't allowed to change. Is it because the baseUrl is also used for file paths?

This is what I did to fix it, is there a better way to do this?

# config/initializers/requirejs_path_override.rb
unless File.basename($0) == 'rake'
  requirejs = Rails.application.config.requirejs
  requirejs.user_config['baseUrl'] = CityEats::CONTEXT + '/assets'
end

Requirejs with jQuery UJS

Can you show me how to use jQuery ujs with requirejs-rails?

make a wrapper and reference in define all the time like jQuery?

Could not find `require.js`, Rails 3.1.3

Hey

please see https://github.com/leahpar/requirejs-rails-error.

It's a blank Rails 3.1.3 app, all steps I took to setup requirejs-rails are separate commits. Still get the same error as listed here: https://github.com/jwhitley/requirejs-rails/issues/4

Please git clone my sample project, make sure you got RVM and ruby-1.9.3-p0 in place. Run bundle install and rails s and visit http://localhost:3000.

In my case the request dies with Sprockets::FileNotFound, couldn't find file 'require.js, app/assets/javascripts/application.js.coffee:1'

Maybe I'm just missing a setup step?

Exclude module dependencies in layered builds doesn't seem to work

Not sure if this relates to #20.

I have a module common which is related to all pages:

define(['jquery'], function($) {
  // ...
});

Each page has a separate module, f.e. page1:

define(['jquery', 'some_other_dep'], function($) {
  // ...
});

My requirejs.yml looks like this:

modules:
  - name: "common"
  - name: "page1"
    exclude: ["common"]

If I precompile my assets, then jquery should only be included in the optimized version of common.
Instead jquery is included in both, common and page1.

I assume this is has to do with the rjs_driver and how it builds a series of individual files. A comment says something about "async builds". What exactly do you mean by that?

Investigate implementation of r.js as Sprockets compressor

On the road to the 0.5.0 release, I've noticed that it may be possible to do a somewhat clean implementation of r.js as a Sprockets compressor. This issue tracks research along those lines, and an implementation if deemed appropriate.

Google maps doesn't get loaded :(

Hi I have something like this in my requirejs.yml and it works in development.

paths:
  twitter_bootstrap: 'shared/twitter_bootstrap'
  async: 'requirejs-plugins/src/async'
  datepicker: 'jquery-plugins/bootstrap-datepicker'

shim: 
  'gmap3':
    deps: ['jquery', 'async!http://maps.googleapis.com/maps/api/js?sensor=true']
    exports: '$.gmap3'

  'twitter/bootstrap': 
    deps: ['jquery']
    exports: '$.bootstrap'

  'jquery-plugins/jquery-autocomplete': 
    deps: ['jquery'] 
    exports: '$.autocomplete'

  'datepicker': 
    deps: ['jquery', 'twitter_bootstrap'] 
    exports: '$.datepicker'

However when I run my site by precompiling assets on heroku (staging) I get google is not defined. For some reason the google map isn't defined? How can I use google maps?

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.