In this recipe, we'll make use of the livescript (0.5.1)
plugin to compile LiveScript source files to JavaScript.
In this example, we'll work with the basic project structure we created in the Installing Grunt on a project recipe in Chapter 1, Getting Started with Grunt. Be sure to refer to it if you are not yet familiar with its contents.
The following steps will take us through creating a simple LiveScript source file and compiling it to JavaScript:
We'll start by installing the package that contains the
contrib-livescript
plugin, as per the instructions provided in the Installing a plugin recipe in Chapter 1, Getting Started with Grunt.Let's create a simple LiveScript file called
main.ls
in our project directory with the following contents:logic = (msg) -> console.log(msg) message = 'Functionality!' logic message
Now, we can add the following
livescript
task to our configuration, which will compile themain.ls
file to themain...