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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:51:24+00:00 2026-05-24T10:51:24+00:00

While starting to use Sass / Compass with Django couldn’t be much easier regardless

  • 0

While starting to use Sass / Compass with Django couldn’t be much easier regardless of platform, it has taken a bit of searching around to find the best way to use CoffeeScript with Django on a Windows development box.

  • 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-24T10:51:25+00:00Added an answer on May 24, 2026 at 10:51 am

    Node support on Windows has greatly improved since I posted my original answer (which I will leave for historical purposes), so now it’s much easier to get this working.

    1. Download and install Node using the Windows installer. You get node and npm commands added to your Windows PATH automatically (available in cmd.exe).

    2. Install CoffeeScript: npm install -g coffee-script. Then just to test, using cmd.exe…

      coffee --version
      CoffeeScript version 1.4.0 #sweet!
      
    3. Install django-compressor: pip install django-compressor.

    4. Add to your settings.py so django-compressor will precompile your CoffeeScript.

      COMPRESS_PRECOMPILERS = (
          ('text/coffeescript', 'coffee --compile --stdio'),
      )
      
    5. Profit! Now use *.coffee files or inline CoffeeScript in Django templates and have it automatically compiled to javascript and combined with your other scripts into a single compressed file.

      Example (taken from django-compressor docs):

      {% load compress %}
      
      {% compress js %}
      <script type="text/coffeescript" charset="utf-8" src="/static/js/awesome.coffee" />
      <script type="text/coffeescript" charset="utf-8">
        # Functions:
        square = (x) -> x * x
      </script>
      {% endcompress %}
      

    Original answer (obsolete):

    The goal is to be able to write CoffeeScript right inside Django templates and have it get automatically converted to Javascript (along with .coffee files). django-compressor has a precompiler that does this, prior to the file compression it’s known best for.

    Of course the issue is you want to use Windows (what’s wrong with you?), and the precompiler assumes you have a typical Linux installation of node.js and coffee-script, able to invoke ‘coffee’ from the command line with all its standard options. To get the same functionality Windows (without resorting to cygwin), you just have to make a little .bat file:

    1. Grab the latest Windows binary of node

    2. Add the path containing node.exe to PATH in Windows system environment variables

    3. Pick one of:

      1. Given that npm is not available for Windows, you can use ryppi, a minimal Python node package manager, to install the coffee-script package. Put ryppi.py in your Python scripts folder.

        cd /d C:\Users\<USERNAME>\  #'node_modules' folder can live here or wherever
        ryppi.py install coffee-script
        
      2. Just download coffee-script from the main site

    4. Add the path\to\coffeescript\bin (containing ‘cake’ and ‘coffee’) to your PATH in Windows system environment variables

    5. Make a batch file so you can use ‘coffee’ from the command line (credit for this) by creating a coffee.bat file in path\to\coffeescript\bin folder above, with this as its contents:

      @pushd .
      @cd /d %~dp0
      @node coffee %*
      @popd
      

      Without this you have to do ‘node \path\to\bin\coffee’ instead of just ‘coffee’.

    6. Try reopening cmd.exe and type…

      coffee --version
      CoffeeScript version 1.1.2  #sweet!
      

      Now you’re using the real coffee-script program on node.

    7. Setup the django-compressor precompiler to use coffee.bat:

      COMPRESS_PRECOMPILERS = (
          ('text/coffeescript', 'coffee.bat --compile --stdio'),
      )
      

      I put that in my local_settings.py file. Just leave off the .bat as usual in the settings file used by your Linux production server or development box. Windows wasn’t happy without the .bat.

    8. Profit!

      Now you can use inline CoffeeScript in your Django templates, and have it automatically compiled to javascript and combined with all your other scripts into a single compressed .js file. I’ll leave details of using django-compressor to it’s documentation.

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

Sidebar

Related Questions

Been starting to work with Core Data a bit, and while I've figured out
I'm starting to use simple_form for a rails application, and while converting some of
Background: I'm starting to use Django for the first time, which is also my
I am starting an application that will use HTML / CSS. While I'm fairly
I get this error while starting jboss, has anyone had it before? 17:10:14,352 ERROR
I am getting a timeout error while starting my Windows service. I am tring
I have been learning python for some time now. While starting this learning python
I'm having trouble starting a transaction with Hibernate and MySQL while running in JUnit.
I'm starting with Ruby, and while making some test samples, I've stumbled against an
I'm starting to get into Unit Testing, Dependancy Injection and all that jazz while

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.