jmparsons / sbt-dustjs-linkedin

An SBT plugin to compile Dustjs templates.
4 stars 5 forks source link

New configuration option amdModule for the compile #6

Closed iviews-ja closed 8 years ago

iviews-ja commented 8 years ago

Added the configuration option amdModule to configure the compile to create amd loader compatible template files

The option is listed on https://github.com/linkedin/dustjs/wiki/Loading-Dust-via-AMD-(require.js). I've tested this locally but don't know how to test this properly with a test case. I hope that this is useful :)

jmparsons commented 8 years ago

Hi @iviews-ja I'll have to test this out later. Is this not working if you just specify the define.amd.dust = true; in your require config file? It looks to me as if it is meant for rjs directly.

iviews-ja commented 8 years ago

As far as I can tell define.amd.dust = true; is for dust.core to register itself as requirejs/amd module at runtime. After that I'm able to depend on the module dust.core.

The templates need to be defined itself as require/amd modules because with define.amd.dust = true; there is no global dust variable any more. This is what dust.config.amd = true does. (further explanations in the wiki linked above).

jmparsons commented 8 years ago

@iviews-ja I checked out the docs. Looks good. It's pushed and published. c3bbd46ffff0334e1f359821f9bd9bf15fcb5ab6

If you'd like to test it out add the amd config flag manually to dust-shell temporarily, cd into the "tester" folder, then enter in your command line:

> sbt
> clean
> web-assets:webNodeModules 
> assets

It will produce assets in target/web/dustjs/main/templates.

Or you can create a new project and reference your local ~/.ivy repository:

resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)

Then from the project directory from your version of sbt-dustjs-linkedin you can publish it locally to ivy using sbt publishLocal. You can bump versions and test it against your local build.