Skip to content

A Maven plugin for compiling coffeescript into javascript.

Notifications You must be signed in to change notification settings

nprudhomme/coffeescript-maven-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Coffeescript Maven Plugin

Yet another coffeescript maven plugin.

Purpose

Love coffeescript. Love Maven. Wanna replace javascript at all.

Just play with your .coffee like what you did to .js before, and let me take care of the rest:

  • Compile (all or modified) coffeescript to javascript.
  • Watch your changing (modify, create, delete, rename) and sync the javascript files at the same time.

Why another coffeescript maven plugin?

There are two maven plugins can compile coffeescript to javascript, as I know:

brew can do more than just compile coffeescript, but it's not up to date, see here.

coffee-maven-plugin works great, but it is short of some features.

Requires

  • Maven 2
  • JDK 7

Usage

Just add the plugin to your pom:

<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>com.github.iron9light</groupId>
      <artifactId>coffeescript-maven-plugin</artifactId>
      <version>1.1.2</version>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

The full pom configuration is here. Configuration options shown are default values and can be ignored for normal use.

<build>
  <plugins>
    <plugin>
      <groupId>com.github.iron9light</groupId>
      <artifactId>coffeescript-maven-plugin</artifactId>
      <version>1.1.2</version>
      <configuration>
        <srcDir>${basedir}/src/main/webapp</srcDir>
        <outputDir>${basedir}/src/main/webapp</outputDir>
        <bare>false</bare>
        <modifiedOnly>false</modifiedOnly>
        <allowedDelete>true</allowedDelete>
        <compilerUrl></compilerUrl>
      </configuration>
      <executions>
        <execution>
          <id>coffeescript</id>
          <phase>generate-resources</phase>
          <goals>
            <goal>compile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Goal:compile

mvn coffeescript:compile

Description:

Compile coffeescript files to javascript files.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: generate-resources.

Optional Parameters:

  • bare Boolean - Bare mode. Default value is: false.
  • modifiedOnly Boolean - Only compile modified files. Default value is: false.
  • outputDir File - Output Directory. Expression: ${basedir}/src/main/webapp
  • srcDir File - Source Directory. Expression: ${basedir}/src/main/webapp
  • compilerUrl String - CoffeeScript compiler file url. It supports both url string and file path string. e.g. http://coffeescript.org/extras/coffee-script.js or ${basedir}/lib/coffee-script.js

Goal:watch

mvn coffeescript:watch

Description:

Compile coffeescript files to javascript files, and recompile as soon as a change occurs.

Attributes:

  • Requires a Maven project to be executed.

Optional Parameters:

  • allowedDelete Boolean - Delete javascript file when the coffeescript file deleted. Default value is: true.
  • bare Boolean - Bare mode. Default value is: false.
  • modifiedOnly Boolean - Only compile modified files. Default value is: false.
  • outputDir File - Output Directory. Expression: ${basedir}/src/main/webapp
  • srcDir File - Source Directory. Expression: ${basedir}/src/main/webapp
  • compilerUrl String - CoffeeScript compiler file url. It supports both url string and file path string. e.g. http://coffeescript.org/extras/coffee-script.js or ${basedir}/lib/coffee-script.js

License

The Apache Software License, Version 2.0.

Acknowledgement

About

A Maven plugin for compiling coffeescript into javascript.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.1%
  • CoffeeScript 1.9%