Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6820453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:25:36+00:00 2026-05-26T21:25:36+00:00

When does Rails compile Coffeescript resources to JavaScript? Does it happen on-demand or at

  • 0

When does Rails compile Coffeescript resources to JavaScript? Does it happen on-demand or at startup?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:25:36+00:00Added an answer on May 26, 2026 at 9:25 pm

    CoffeeScript compiles to JavaScript on demand when a request is made to a view that includes a CoffeeScript resource.

    However, you can use the following to have CoffeeScript compile to JavaScript ahead of time:

    rake assets:precompile
    

    See this link for more information on the Rails asset pipeline.

    From the link:

    The file extensions used on an asset determine what
    preprocessing is applied. When a controller or a scaffold is generated
    with the default Rails gemset, a CoffeeScript file and a SCSS file are
    generated in place of a regular JavaScript and CSS file. The example
    used before was a controller called “projects”, which generated an
    app/assets/javascripts/projects.js.coffee and an
    app/assets/stylesheets/projects.css.scss file.

    When these files are requested, they are processed by the processors
    provided by the coffee-script and sass-rails gems and then sent back
    to the browser as JavaScript and CSS respectively.

    …

    Assets are compiled and cached on the first request after the server
    is started. Sprockets sets a must-revalidate Cache-Control HTTP header
    to reduce request overhead on subsequent requests — on these the
    browser gets a 304 (Not Modified) response.

    If any of the files in the manifest have changed between requests, the
    server responds with a new compiled file.

    …

    Rails comes bundled with a rake task to compile the asset manifests
    and other files in the pipeline to the disk.

    Compiled assets are written to the location specified in
    config.assets.prefix. The default setting will use the public/assets
    directory.

    You must use this task either during deployment or locally if you do
    not have write access to your production filesystem.

    The rake task is:

    bundle exec rake assets:precompile

    UPDATE:
    For those interested in precompiling assets for development, set the RAILS_ENV variable to development first (from here):

    RAILS_ENV=development bundle exec rake assets:precompile
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Rails 2.3 support a file-based session store out of the box any more?
Does rails do any validation for datetime? I found a plugin http://github.com/adzap/validates_timeliness/tree/master , but
Where does Rails store data created by saving activerecord objects during tests? I thought
Ruby on Rails does not do multithreaded request-responses very well, or at least, ActiveRecord
Does ruby or rails provide a method to order strings in a specified order?
Does Ruby (or Rails) provide an easy way to accomplish the following: if @author.articles.each(:published
Does anyone know of any method in Rails by which an associated object may
In Rails Migrations, what does the number specified for the :limit parameter on an
Does anyone know a way to determine if a Rails association has been eager
Does anyone have an example of setting up Authlogic with a namespace in Rails?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.