2

Goal

My goal is to to get Twitter Bootstrap to worth with my Play 2.x scala project. Because i can't get it to wrok i decided to start an empty project to see if i can get the hang of 'less'. Now thats where i'm stuck, as i can't seem to get 'less' to compile/do anything!

Simple reproduction in an empty project

  • Downloaded http://www.playframework.org/download play-2.0.2-RC2.zip and extracted that to my debian linux box. (Why play-2.0.2-RC2? Because the 'less' version in there is compatible with the latest twitter bootstrap as mentioned here.)
  • Created a new play project play new zzz (zzz=name of the test project).
  • Went to zzz/public/stylesheets and added a file named q.less (its content is the first example on this page http://lesscss.org/, simple variable name usage).
  • Because i'm testing a lot i each time type: play clean-all in the commandline before each new test/Build.scala/etc file change.
  • Started play and typed:

The plot thickens

Now after reading a a message on google groups i spotted two things:

  1. He hinted the less compiler in Build.scala to only build certain files. Which isn't a problem for my empty 'zzz' test project (as it doesnt have partial twitter bootstrap less files), but i added these lines nevertheless to test: lessEntryPoints <<= baseDirectory(_ / "app" / "assets" / "stylesheets" ** "q.less").
    • Note: if i type play-less-entry-points in the play console i get two empty lines just stating '[info]' ... nothing more. Something wrong there?
  2. He (and someone else) mentioned the play commands play-copy-assets and copy-resources. I entered these commands at the above replication step at '(*)'. Same result, no css files.

Edit: my 'target' directory listing

My target directory listing after testing the above, and before i 'reset' it with a play clean-all in the command line looks like this:

cache  classes  classes_managed  src_managed

It doesn't have the mentioned 'resource_managed' directory. Is there a log / verbose mode i can see if the less compilere is called at all. Perhaps there is a less syntax error in my test file? I just dont know anymore :).

Perhaps related, but not important for my question?

Perhaps related and might help me understand it ... but: The official 'site' mentions the use of a double '**' in the lessEntryPoints lines. Here on stackoverflow uses one '*' and the message on google groups doesn't even use it. How does that work?

My question

I'd like to understand what i'm doing 'wrong' here. With that knowledge i'm sure i'm able to get twitter bootstrap into my play project.

Community
  • 1
  • 1
df'
  • 300
  • 4
  • 14

1 Answers1

5

Just to be sure, make sure that your *.less files are located under the "app/assets/..." folder and not in your "public" folder.

Only the files located under the "app" (and "conf") folder(s) are compiled.

ndeverge
  • 21,378
  • 4
  • 56
  • 85
  • I just did a quick test and indeed this was the case :(. Thanks for the tip! ... once i'm home i'm gonna check if i could have read this in the documentation or not ... because ... damn i feel stupid :). – df' Jun 24 '12 at 13:34