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 8620191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:31:25+00:00 2026-06-12T06:31:25+00:00

I have a Coffeescript/Javascript project that is a large web application and I’m using

  • 0

I have a Coffeescript/Javascript project that is a large web application and I’m using the C++ preprocessor to piece the files together with some #ifdef and #include directives. It has dramatically simplified and organized my source. I’m using rake as my build tool.

I can call the cpp -E -Xpreprocessor directive as a system call from rake, but I’d love to be able to just use it within the Rake script itself.

e.g. current usage

pre_processed_code = `cpp -E -Xpreprocessor -DDebug app.coffee`

Are the any ruby implementations of the C++ preprocessor that you can run a string through or can anyone suggest a better pre-processing workaround?

  • 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-06-12T06:31:26+00:00Added an answer on June 12, 2026 at 6:31 am

    Rails solves problems like this with the asset pipeline. It can orchestrate the CoffeeScript -> JavaScript transforms, and you can readily include source files (or directory trees) to have them concatenated and minified.

    Sprockets supports chaining filters. For example, foo.js.coffee will be treated as CoffeeScript that produces JavaScript, which may itself include other dependencies and is a candidate for minification. Pulling in external variables for conditional compilation, inlining objects from a database, and other wacky behavior can be readily accommodated by chaining in other filters, e.g. foo.js.coffee.erb:

    <% if environment == 'production' %>
    log = (args...) ->
      # no-op
    <% else %>
    log = (args...) ->
      console.log(args...)
    <% end %>
    

    All this is customarily executed on the fly in development and via in a compilation step in production, where individual source files are processed, joined, and optimized before delivery to the web server. This all works for CSS preprocessors and JavaScript template languages, too — if there’s a web-related thing that someone wants to compile, there’s likely support for it somewhere.

    You’re probably not using Rails, but that shouldn’t stop you from leveraging all this work: the asset pipeline is actually a standalone gem called Sprockets. You can likely bolt it on in place of your existing build process. This isn’t a C++ preprocessor, but it is what a lot of other people are doing to solve this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails 3.1 project that I'd like to run some jasmine specs
I get the following error when I have coffeescript files in my assets/javascript folder
I'm using coffeescript with --watch option to rebuild javascript on changes to .coffee files.
I have recently started using coffeescript with Rails and I am finding that sometimes
I have a section of Javascript/Coffeescript that seems to be executing out of order.
I have been reading up on Mixins using Coffeescript or just plain Javascript from
I have these a coffeescript file for a model entree that just instanciates a
I'm in the early stages of a web application that will contain a client
I'm translating a piece of code from javascript to coffeescript. for (var i =
I have some code written in CoffeeScript and I want to optimize the generated

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.