All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.webjars.play.RequireJS.scala Maven / Gradle / Ivy

There is a newer version: 2.8.18
Show newest version
package org.webjars.play

import javax.inject.{Inject, Singleton}

import play.api.http.MimeTypes
import play.api.mvc.{Action, AnyContent, InjectedController}

@Singleton
class RequireJS @Inject() (webJarsUtil: WebJarsUtil) extends InjectedController {

  def setup(): Action[AnyContent] = Action {
    val setupJavaScript = if (webJarsUtil.useCdn) {
      org.webjars.RequireJS.getSetupJavaScript(webJarsUtil.cdnUrl + "/", routes.WebJarAssets.at("").url)
    }
    else {
      org.webjars.RequireJS.getSetupJavaScript(routes.WebJarAssets.at("").url)
    }
    Ok(setupJavaScript).as(MimeTypes.JAVASCRIPT)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy