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

  • Home
  • SEARCH
  • 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 8415781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:32:47+00:00 2026-06-10T01:32:47+00:00

We can compile coffescript file to js-file with command: coffee –join path/to/result.js –compile path/to/coffeescript_dir/

  • 0

We can compile coffescript file to js-file with command:

coffee –join path/to/result.js –compile path/to/coffeescript_dir/

But what if I want to compile a piece of coffeescript code (as text) and get piece of js code (as a text too), and they are not files.
For example:

  • cs text: "func = () -> 55"

  • js text result: "var func; func = function(){return 55;}"

It must be done from console, or even better from python interactive console 🙂

  • 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-10T01:32:49+00:00Added an answer on June 10, 2026 at 1:32 am

    You can use --eval to take a string parameter as coffee input, --bare to avoid the JS output being wrapped in a closure, and --print to print the output on stdout instead of a file:

    $ coffee --print --bare -eval 'func = -> 55' 
    var func;
    
    func = function() {
      return 55;
    };
    

    To call it from Python, you can use the subprocess module:

    from subprocess import Popen, PIPE
    def compile_cs(cs_code):
        args = ['coffee', '--print', '--bare', '--eval', cs_code]
        return Popen(args, stdout=PIPE).communicate()[0]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I'm using the following command to compile a coffeescript file each time
I just want to know if we can compile a single file/class in visual
How can I compile and run a python file (*.py extension)?
I'm trying to get the nodeunit module working within a coffeescript project but can't
I can compile instructions to bytecode and even execute them easily but the only
TLDR: What can you do to combine multiple CoffeeScript files into one JS file,
I can compile but can't execute the following code with the error (using Postgres):
How can it be that Netbeans can compile and run apps, but that the
I have a simple C++ program that I can compile (g++ from command line)
Is there some setting in VS2K8 or some command line utility that can compile

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.