Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9138577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:16:29+00:00 2026-06-17T09:16:29+00:00

I’m currently building a website using the Play! 2.0 (2.1-RC2) framework and Scala. I

  • 0

I’m currently building a website using the Play! 2.0 (2.1-RC2) framework and Scala. I have a bunch of “static” html files that define my views used by AngularJS (I’d much rather use Jade, but I can’t seem to find a way to get Jade to be precompiled with Play/Scala.. which makes sense, since Jade templates usually aren’t static).

What makes the most sense for me, as a developer, and my project’s structure is to have these html files in the same place as my coffee and less files (/assets/*). I understand that Play wants me to put them in my public folder, however I have a hard time with that. To me, the public folder should be for libraries and generated files.

What I’d like to do is somehow get Play to copy the html files in /assets/views to /public/views as part of the build. How could I accomplish this?

Many thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:16:30+00:00Added an answer on June 17, 2026 at 9:16 am

    I was able to figure out how to do this in a Scalatra test project, so I just need to modify the following code to adapt it to Play’s folder structure. It does, however, work. What it does is defines a new sbt “Plugin” and, at compile time, copies any files in /src/main/html to /resource_managed/main/views.

    Hopefully someone will find this useful!

    import sbt._
    import Keys._
    import java.io.File
    import org.apache.commons.io.FileUtils._
    
    object CopyViews extends sbt.Plugin {
      import CopyViewsKeys._
    
      object CopyViewsKeys {
        val copy = TaskKey[Unit]("copy-views", "Copy views into resourceManaged.")
      }
    
      private def copyViewsTask = (streams, sourceDirectory in copy, resourceManaged in copy) map {
        (out, source, destination) =>
          out.log.info("Copying Views to " + destination.getAbsolutePath())
          copyDirectory(source, destination)
      }
    
      def copyViewsSettingsIn(c: Configuration): Seq[Setting[_]] =
        inConfig(c)(Seq(
          sourceDirectory in copy <<= (sourceDirectory in c) { _ / "html" },
          resourceManaged in copy <<= (resourceManaged in c) { _ / "views" },
          copy <<= copyViewsTask
        )) ++ Seq(
          compile in c <<= (compile in c).dependsOn(copy in c)
        )
    
      def copyViewsSettings: Seq[Setting[_]] = 
        copyViewsSettingsIn(Compile)
    }
    
    object ModFallBuild extends Build {
      import CopyViews._ // Import in our Build so we can use in our build.sbt file.
    
      lazy val modfall = Project("modfall", file("."))
    }
    

    Now, in our build.sbt file we can add

    seq(copyViewsSettings:_*)
    

    And the views are now copied at compile time 🙂

    There is probably an easier way to do this, I’m sure, but this works for me and was able to let me get an understanding of building a sbt plugin! 😛

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.