jwhitley / requirejs-rails

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

Can not require custom js file in production with asset-pipeline enabled #151

Closed dechaoqiu closed 10 years ago

dechaoqiu commented 10 years ago

In development environment, it works good. However, after I deployed the system into production with asset-pipeline enabled, it can not require my own js file.

In app/views/layouts/application.html.erb, I included:

<%= requirejs_include_tag "application" %>

and in app/assets/application.js.coffee, I included:

require [
    'questions'
]

and I do have the file: app/assets/javascripts/questions.js.coffee, but it can not find it in production environment.

I have tried to add the following line into config/environments/production.rb

config.assets.precompile += %w( questions.js )

but even with this config, the compiled questions.js was renamed with fingerprint appended.

So I this this might be a potential issue of requirejs-rails, which does not take fingerprint into consideration? Or it might be my error configuration.

klebervirgilio commented 10 years ago

+1

carsomyr commented 10 years ago

@renoqiu You need to say <%= requirejs_include_tag "questions" %> while using the module and exclude configuration keywords. See this document for usage. I'll reopen if you're still confused.