cmcculloh
cmcculloh

Reputation: 48583

How can I use literate coffeescript for my Gruntfile

Grunt files must either be "Gruntfile.js" or "Gruntfile.coffee". So, how can I write my Gruntfile using literate coffeescript instead of vanilla coffeescript (since, I believe, literate coffeescript files need to be named with a .litcoffee at the end instead of just .coffee)?

Upvotes: 2

Views: 683

Answers (2)

MalucoMarinero
MalucoMarinero

Reputation: 359

Make this your Gruntfile.coffee. You could just as easily do it as a js file of course, as long as node knows what litcoffee is supposed to parse like (that's why you require coffee-script)

coffee = require 'coffee-script'
module.exports = require './Gruntfile.litcoffee'

This is under the assumption that the litcoffee file's export is the (grunt) -> function

Upvotes: 1

Billy Moon
Billy Moon

Reputation: 58521

You could have a Gruntfile.coffee act as a bootstrapper for the Gruntfile.litcoffee file, something like this pseudo code...

coffee = require "coffee-script"

module.exports = eval coffee.compile "Gruntfile.litcoffee"

Upvotes: 1

Related Questions