jwhitley / requirejs-rails

RequireJS support for your Rails 3 or 4 application
MIT License
592 stars 201 forks source link

Readme says to avoid precompile? #97

Closed pboling closed 11 years ago

pboling commented 11 years ago

from the readme:

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 precompile, and almond as my requirejs builder, was the ONLY way I was able to get it working. What is the alternative? This is what mine works like:

  config.assets.precompile += %w(
    main.js
      domReady.js
      jquery-adapter.js
        jquery.js jquery_ujs.js
      foundation-adapter.js
        foundation/jquery.cookie foundation/jquery.event.move foundation/jquery.event.swipe foundation/jquery.foundation.accordion foundation/jquery.foundation.alerts foundation/jquery.foundation.buttons foundation/jquery.foundation.clearing foundation/jquery.foundation.forms foundation/jquery.foundation.joyride foundation/jquery.foundation.magellan foundation/jquery.foundation.mediaQueryToggle foundation/jquery.foundation.navigation foundation/jquery.foundation.orbit foundation/jquery.foundation.reveal foundation/jquery.foundation.tabs foundation/jquery.foundation.tooltips foundation/jquery.foundation.topbar foundation/jquery.offcanvas foundation/jquery.placeholder foundation/modernizr.foundation foundation/app
      home.js
  )
pboling commented 11 years ago

The readme also says in step 6:

requirejs-rails defaults to a single-file build of application.js.

That was not the case for me. I only was able to get the single file build after switching to the almond.

pboling commented 11 years ago

I have now tested it with the entire pre-compile section commented out, and it is working. I did need to switch back to application.js as my "main" otherwise it built an application.js in addition to the main.js.