Search code examples
javascriptcssplayframeworkgoogle-closure-compilerplayframework-2.2

Best way of structuring js and css files in my play2 app


I'm trying to understand how I should structure my js and css files in my app. If I look at the anotomy of a play2 app:

app                      → Application sources
 └ assets                → Compiled asset sources
    └ stylesheets        → Typically LESS CSS sources
    └ javascripts        → Typically CoffeeScript sources
 └ controllers           → Application controllers
 └ models                → Application business layer
 └ views                 → Templates
public                   → Public assets
 └ stylesheets           → CSS files
 └ javascripts           → Javascript files
 └ images                → Image files

currently all my files resides in public folder. But for the Google Closure compiler(minification) to work I need to place the files in app/assets.

How have you solved this? By symlinking the files to the other folder? Keeping all your js and css files in app/assets?

Maybe you some other nice idea?


Solution

  • Everything will end up under /public when Play compiles/builds your app. You don't have to worry about it.

    Just put your Google Closure scripts and LESS stylesheets under that need compiling under /assets and any static scripts/stylesheets/images under /public.