3

I am using coffeescript-resources and the lesscss-resources plugins, how can I generate the resources to get the raw js/css ?

I know I can package it then explode the war, but is there a way to get the outputs in a simpler way?

Nix
  • 57,072
  • 29
  • 149
  • 198

2 Answers2

1

When dealing with resources plugins, it's always useful to take a look at the actual resourceMappers to see how the generation is done.

It seems like the coffeescript plugin contains a CoffeeScriptEngine that compiles the coffeescript files, so you can call that directly ( Line 30 of https://github.com/edvinasbartkus/grails-coffeescript-resources/blob/master/grails-app/resourceMappers/CoffeeScriptResourceMapper.groovy ).

Similarly, the less compiler - https://github.com/paulfairless/grails-lesscss-resources/blob/master/grails-app/resourceMappers/LesscssResourceMapper.groovy

The way the grails resources plugin works makes it very difficult to get standalone files. You're better off using a tool in development like Codekit http://incident57.com/codekit/

Tomas Lin
  • 3,532
  • 1
  • 22
  • 19
  • So are you saying I can't do what I want? Or I have to write something to programmatically do it ? – Nix Apr 02 '13 at 16:46
  • basically yes. Resources plugin handles all the compilation of resources on demand when the resource is first requested. You can't really pre-process resources for later use. I think it's what makes it philosophically different than a plugin like ui-performance. You can always use Grunt or Yeoman for less / sass / coffeescript if you really want generated files. – Tomas Lin Apr 02 '13 at 17:19
0

Try grails-grunt plugin.

It seems that this is what you need. You can create own compilation process for CoffeeScript, LESS and others by using Grunt.

Eugene Hoza
  • 621
  • 1
  • 6
  • 19