Using npm in Play!

1,021 views
Skip to first unread message

Alex Loskutov

unread,
Nov 12, 2014, 10:17:22 AM11/12/14
to play-fr...@googlegroups.com

https://www.playframework.com/documentation/2.3.6/Migration23

npm

npm can be used as well as WebJars by declaring a package.json file in the root of your project. Assets from npm packages are extracted into the same lib folder as WebJars so that, from a code perspective, there is no concern whether the asset is sourced from a WebJar or from an npm package.


I added package.json in my project folder and no one of my dependencies in package.json weren't added into lib.  Also I try to add package.json in app folder but it wasn't helpfull


How can I use package.json  correctly?

Simon Ochsenreither

unread,
Nov 16, 2014, 7:33:41 PM11/16/14
to play-fr...@googlegroups.com
I'm no expert, but maybe the documentation intended to say that you should run npm, and npm then places the libraries there?

Christopher Hunt

unread,
Nov 16, 2014, 8:11:52 PM11/16/14
to play-fr...@googlegroups.com

I added package.json in my project folder and no one of my dependencies in package.json weren't added into lib.  Also I try to add package.json in app folder but it wasn't helpfull

What did you do to determine this? What happens if you type:

    show web-node-modules

...in the sbt console?

package.json should be at the root of your project directory.

Alex Loskutov

unread,
Nov 17, 2014, 7:36:47 AM11/17/14
to play-fr...@googlegroups.com

[error] No such setting/task

[error] show web-node-modules

[error]


понедельник, 17 ноября 2014 г., 4:11:52 UTC+3 пользователь Christopher Hunt написал:

Christopher Hunt

unread,
Nov 17, 2014, 4:23:23 PM11/17/14
to play-fr...@googlegroups.com
Sorry, try “show web-assets:web-node-modules”

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/tCvxLiN4CHo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Loskutov

unread,
Nov 20, 2014, 8:18:13 AM11/20/14
to play-fr...@googlegroups.com
this command node_modules to project directory

but I can't access them throw the AssetController

вторник, 18 ноября 2014 г., 0:23:23 UTC+3 пользователь Christopher Hunt написал:

Alex Loskutov

unread,
Nov 20, 2014, 8:54:59 AM11/20/14
to play-fr...@googlegroups.com
maybe I have some mistakes in sbt files

plugins.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")

//idea plugin

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.2")


build.sbt

name := """bet-search"""

version := "1.2.1"

scalacOptions += "-feature"

lazy val root = (project in file(".")).enablePlugins(PlayScala, SbtWeb)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
ws,
cache,
"org.jsoup" % "jsoup" % "1.8.1"
)

pipelineStages := Seq(rjs, digest, gzip)







вторник, 18 ноября 2014 г., 0:23:23 UTC+3 пользователь Christopher Hunt написал:
Reply all
Reply to author
Forward
0 new messages