Closed hsyed closed 10 years ago
Sbt-web's approach is quite different. Rjs is now configured exactly as if you were using it outside of Play.
The purpose of WebJars is to leverage existing tooling and infrastructure.
My guess here is that an older version of play is included given the dependency on WebJars-play.
I'm going to close this issue for now.
Yes I thought that might be the case (new way of doing this), in this case could you give me some pointers as to how best achieve my use-case with sbt-web (loading the webjars-requirejs.js automatically based on the web jars dependencies declare in the build file) ?
We are considering moving to web jars at work and would need the use-case above. We are loading dozens of dependencies at the moment manually, and this is without any other tools --i.e., no NPM or requires etc, just the angular module loader / injector. I need to nail this down so we can begin porting our in house JS modules to web jars, but it wouldn't be worth the investment for the next project unless I can remove the boilerplate above.
Sorry, I'm really new to web-development and play in general. Learning the whole stack --i.e., angular, css, requires, JS, play, web unit testing etc simultaneously :(.
We are in the process of a typesafe subscription for our team :D Guess I could raise a ticket once it goes through.
You'll need to declare an rjs path config in your main.js - as per the project provided. The upside of this is that sbt-rjs looks for them and automatically substitutes CDN paths for the WebJars when you create a dist for production.
So is this the currently prescribed solution ?
requirejs.config({
paths: {
'angular': ['../lib/angularjs/angular'],
'angular-ui-router' : ['../lib/angular-ui-router/angular-ui-router'],
'angular-resource' : ['../lib/angularjs/angular-resource'],
'ui-bootstrap-tpls' : ['../lib/angular-ui-bootstrap/ui-bootstrap-tpls']
},
shim: {
'angular': {
exports: 'angular'
},
'angular-ui-router' : {
deps : ['angular']
},
'angular-resource' : {
deps : ['angular']
},
'ui-bootstrap-tpls' : {
deps :['angular']
}
}
});
require(['angular', './controllers', './directives', './filters', './services',
'angular-ui-router', 'angular-resource','ui-bootstrap-tpls'],
function(angular, controllers) {
...
}
This would become rather unwieldy when dozens of dependencies are involved.
I agree with you. However do you accept that this is an rjs issue and not really a WebJars one?
That said, we could probably re-instate some support for rjs in sbt-web if this becomes a common issue.
I just retrofitted an older version of the seed project (2.2) to 2.3 and want to get the dependencies to wire up their webjars-requirejs.js files automatically. The recent seed project does not demonstrate this, and it doesn't have a dependency on webjars-play anymore so I cannot figure out what I am doing wrong.
Specifically I do not want to do this as it defeats the purpose of webjars and sbt integration :
My config :
routes :
build.sbt :
plugins :
template :
error :