hepek icon indicating copy to clipboard operation
hepek copied to clipboard

Macro for static resources

Open sake92 opened this issue 5 years ago • 1 comments

A very cool feature would be to have a macro that reads from src/main/public path and builds a tree of Resources. E.g. if you have this tree:

site
    ├───images
    │       favicon.ico
    ├───scripts
    │       main.js
    └───styles
            main.css

it would generate this:

object resources {
  object site {
    object images {
      val favicon_ico = resource("favicon.ico")
    }
// ... etc
  }
}

Then you could say just resources.site.image.favicon_ico.ref to get the path to favicon.ico. 😃
Since .ref returns a relative path, this would be very helpful.

sake92 avatar Aug 03 '19 11:08 sake92

Doesnt have to be a macro.. just a simple plugin/task

sake92 avatar Feb 28 '22 12:02 sake92

https://www.scala-sbt.org/1.x/docs/Howto-Generating-Files.html

https://mill-build.com/mill/Extending_Mill.html#_example_customizing_the_meta_build generatedSources ..

sake92 avatar Dec 08 '23 06:12 sake92

Done in https://github.com/sake92/sbt-hepek/commit/534c157abe49861188c6f83f9acf8390842b6dea https://github.com/sake92/mill-hepek/commit/a1fec9f515d4f254eb89907bc5eab9d0a6c4b9e3

sake92 avatar Dec 08 '23 17:12 sake92