Closed ehudkaldor closed 8 years ago
I am not familiar with jspm or Aurelia, but it seems easy since sbt-play-gulp
just calls gulp commands from sbt and the Yeoman Aurelia generator uses gulp. The functionality to run bower within the sbt session is just optional.
If you want to use Aurelia as frontend with jspm, clone play-gulp-demo, replace the contents of the ui
directory with the skeleton project (skeleton-es2016) generated by Yeoman Aurelia generator, and add gulp tasks which this plugin needs to call if not found in ui/build/tasks/*.js
:
$ npm i -g generator-aurelia
$ git clone https://github.com/mmizutani/play-gulp-demo.git
$ cd play-gulp-demo/ui
$ yo aurelia
var gulp = require('gulp');
gulp.task('compile', ['build']);
gulp.task('run', ['serve']);
Remove the following lines:
def templateDemo = Action {
Ok(views.html.demo("Scala template in Angular")
(Html("<div>This is a play scala template in angular views folder which is compiled and used inplace!</div>"))
)
}
def serveTemplate = Action {
Ok(views.html.templ("Compiled from a scala template!"))
}
and
GET /ui/views/templ.html controllers.Application.serveTemplate
GET /tdemo controllers.Application.templateDemo
Then as usual:
$ jspm install
$ cd ../
$ sbt
> run
You should use the standalone version of this sbt plugin, play-gulp-standalone. This standalone version allows you to fully customize play-gulp integration settings for any frontend html projects and to make any non-sbt commands you like to be runnable on sbt by editing project/PlayGulp.scala
:
commands <++= gulpDirectory {
base =>
Seq(
"npm",
"bower",
"yo",
"jspm",
"ied",
"npmd",
"git"
).map(cmd(_, base))
}
In this repository, I have just created the jspm branch, which is an example of a Play app with Aurelia frontend and jspm package manager. You can run jspm and git in an sbt session. See the app in action: https://play-gulp-aurelia-jspm.herokuapp.com/
I am very new to this whole business, but if I read correctly, there is not much to it because the config for jspm is part of package.json, so all that's needed is to allow running it in SBT/activator.
My interest is because i want to use Aurelia as frontend, and they use jspm.