Nustache icon indicating copy to clipboard operation
Nustache copied to clipboard

How to add Nustache to Xamarin project? I've got problem with targetFramework...

Open demylia opened this issue 9 years ago • 10 comments

In Package console, I see next:

Adding Nustache... Adding 'Nustache 1.15.3.7' to testFrameworcTarget. Could not install package 'Nustache 1.15.3.7'. You are trying to install this package into a project that targets 'portable-net40+sl50+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', , but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author

demylia avatar Dec 24 '15 13:12 demylia

Hi there,

Sorry for the delay in replying. Nustache doesn't have a mono build unfortunately and I'm currently only bug-fixing issues and taking pull requests on this project. I've moved to developing my own Mustache templating engine called Stubble.

If you'd like to open an issue in that repo, I know that it builds using Mono and i'd be happy to work with you to get the nuget package to install correctly in a Xamarin project.

Thanks,

Romanx avatar Dec 29 '15 09:12 Romanx

Romanx, I've just copied all classes to my project and it works now. But I've got a new problem: I have a html-template (string type) and a json (string type), I create a JObject, then I use the method Render.StringToString(template,JObject,null), the generation works only for - Variables and Sections, but doesn't work for - False Values or Empty Lists, Inverted Sections. Can you improve this behavior or maybe you know another possible - how to generate Anonymous C# class from json in runtime? I want to get from server the new templates and new json after the compilation of app, thus i don't know which Properties will be inside of my Model Thanks in advance

demylia avatar Dec 29 '15 12:12 demylia

Hey,

If you could provide a reproduction case I could take a look. As i mentioned above i'm not really working on this as i'm improving functionality on my separate library. I've added explicit code for Json.Net in that library here.

A reproduction case would be useful as i could see how much work getting this working would be for you,

Cheers

Romanx avatar Dec 29 '15 12:12 Romanx

Romanx, thanks a lot for your cool job! I've just added all needed classes to my project and now it works well. By now I would like to know how to make a package for Portable Class Library in Xamarin, how to do it (maybe I can find out it using google, I didn't see it yet)

demylia avatar Dec 29 '15 13:12 demylia

Nuget not working with the same error you get with Nustache?

Romanx avatar Dec 29 '15 13:12 Romanx

Nuget even don't see your package "Stubble", anyway I think that the error will be the same

demylia avatar Dec 29 '15 13:12 demylia

It's slightly confusing sorry. I split them out quite widely.

  • Core Package This contains the core functionality of the mustache renderer.
  • Json.Net Extensions This is the extension package that adds all the Json.net specific functionality
  • Stubble.All This is the combined package which merges all the extensions into one easy to use dll.

If you'd like to try including them from nuget, i'm not sure if they'd work as i've not tested the scenario although all my tests do run under mono. Either way a reproduction case would be excellent so I can try help with your issue.

Romanx avatar Dec 29 '15 15:12 Romanx

Hi Romanx, the Stubble library works correct with JObject. Now, I would want to add the SDWebImage library to my project to cache the images. And what I want to do is add some code to your class from this lib which let me to change global references on images to local (if the cache have these images ). Only after that invoke the Render method. 1) Can you tell me in which class you iterate inside of the collection in JObject. 2) Can you add me to your skype: demylia Thank you in advance

demylia avatar Jan 13 '16 08:01 demylia

Hi @demylia Since this is now more a Stubble issue than a Nustache one could you open a ticket over there and i'll try help you, thanks.

Romanx avatar Jan 13 '16 11:01 Romanx

ok, I agree with you

demylia avatar Jan 14 '16 14:01 demylia