PHPackages                             pug-php/pug-filter-coffee-script - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pug-php/pug-filter-coffee-script

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pug-php/pug-filter-coffee-script
================================

Render CoffeeScript code as JavaScript in a script tag

1.3.1(8y ago)2106.5k↓44.8%2MITPHP

Since Jun 23Pushed 6y ago2 watchersCompare

[ Source](https://github.com/pug-php/pug-filter-coffee-script)[ Packagist](https://packagist.org/packages/pug-php/pug-filter-coffee-script)[ RSS](/packages/pug-php-pug-filter-coffee-script/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (2)

pug-filter-coffee-script
========================

[](#pug-filter-coffee-script)

[![Latest Stable Version](https://camo.githubusercontent.com/a81b441b1c6548104259b397c8a8bbabc3a061afa43561f139dd91ca0ea62cf1/68747470733a2f2f706f7365722e707567782e6f72672f7075672d7068702f7075672d66696c7465722d636f666665652d7363726970742f762f737461626c652e706e67)](https://packagist.org/packages/pug-php/pug-filter-coffee-script)[![Build Status](https://camo.githubusercontent.com/6a42c7d12783ebf5f620c120e87da3aa5ef89b31bd0e5db0163a2b83da14c5de/68747470733a2f2f7472617669732d63692e6f72672f7075672d7068702f7075672d66696c7465722d636f666665652d7363726970742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pug-php/pug-filter-coffee-script)[![Code Climate](https://camo.githubusercontent.com/bf24d4b0212ee1145825f232dfc399987008206bd10e5b64bf28b6ae0984ffd6/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7075672d7068702f7075672d66696c7465722d636f666665652d7363726970742f6261646765732f6770612e737667)](https://codeclimate.com/github/pug-php/pug-filter-coffee-script)[![Test Coverage](https://camo.githubusercontent.com/ab73cdb3ba48cfa7d3a1917d90facc6d91e1b44822f08acf471846f26a66c0af/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7075672d7068702f7075672d66696c7465722d636f666665652d7363726970742f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/pug-php/pug-filter-coffee-script/coverage)[![StyleCI](https://camo.githubusercontent.com/3d139a20ac67ba8241bc40619d2c40e91473f7ba46d17d6f62441410c4004bdd/68747470733a2f2f7374796c6563692e696f2f7265706f732f36313830363835342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/61806854)

This template:

```
body
  :coffee-script
    # Assignment:
    number   = 42
    opposite = true

    # Conditions:
    number = -42 if opposite

    # Functions:
    square = (x) -> x * x

    # Arrays:
    list = [1, 2, 3, 4, 5]

    # Objects:
    math =
      root:   Math.sqrt
      square: square
      cube:   (x) -> x * square x

    # Splats:
    race = (winner, runners...) ->
      print winner, runners

    # Existence:
    alert "I knew it!" if elvis?

    # Array comprehensions:
    cubes = (math.cube num for num in list)
```

will be rendered like this:

```

    var cubes, list, math, num, number, opposite, race, square,
    __slice = [].slice;

    number = 42;

    opposite = true;

    if (opposite) {
      number = -42;
    }

    square = function(x) {
      return x * x;
    };

    list = [1, 2, 3, 4, 5];

    math = {
      root: Math.sqrt,
      square: square,
      cube: function(x) {
        return x * square(x);
      }
    };

    race = function() {
      var runners, winner;
      winner = arguments[0], runners = 2
