Git Product home page Git Product logo

Comments (10)

andreespirela avatar andreespirela commented on May 8, 2024

Hello.
In regards to point 1, I will be running some tests and see what is going on. It sounds like a bug.

In regards to point two, that is something of Denjucks. Maybe there can be some workaround if it has the option to configure the template folder where it reads the inclusion. We will check this out but directly, it is not related to Mandarine. Let’s see if there’s some workaround to it

from mandarinets.

andreespirela avatar andreespirela commented on May 8, 2024

@ThauEx I can't seem to reproduce this behavior. Can you confirm the property templateEngine is inside the property mandarine?. It should look like this:

    "mandarine": {
        "templateEngine": {
            "engine": "denjucks"
        }
    }

from mandarinets.

ThauEx avatar ThauEx commented on May 8, 2024

I cleared the cache, but the issue persists. My config looks like this:

{
  "mandarine": {
    "server": {
      "port": 9999
    },
    "resources": {
      "staticFolder": "./public"
    },
    "templateEngine": {
      "path": "./templates",
      "engine": "denjucks"
    }
  }
}

When I enter something invalid as engine, it throws an error. So the config should be correct.
I can try to prepare an example if you want.

from mandarinets.

andreespirela avatar andreespirela commented on May 8, 2024

Sure. Let me see your code, the command you’re running to start up the application, and an screenshot with your folder’s structure (so directories and files). From that I will try to run it and see what’s going on.

from mandarinets.

ThauEx avatar ThauEx commented on May 8, 2024

Okay, great. I will provide it tomorrow (it already late here).

from mandarinets.

andreespirela avatar andreespirela commented on May 8, 2024

Great. Make sure you’ve ran —reload, and your whole app is pointing to @v1.0.1 . Sorry for this inconvenience, when the details are provided I will investigate further.
Regards.

from mandarinets.

andreespirela avatar andreespirela commented on May 8, 2024

@ThauEx Please also provide the code of the template. Regards.

from mandarinets.

ThauEx avatar ThauEx commented on May 8, 2024

Here is a sample project, run it via deno run --config tsconfig.json --allow-net --allow-read --unstable app.ts
It has two endpoints:
http://localhost:9999/test
http://localhost:9999/test2
Both should show the same, but the second one has the template engine configured inside the controller and the first one is taking it from the config (where the same is configured)
project.zip

If you need more, just tell me and thank you for the inventigation.

from mandarinets.

andreespirela avatar andreespirela commented on May 8, 2024

@ThauEx I see why this is happening. I am glad to inform it is not a bug :).
Screen Shot 2020-06-08 at 12 46 44 PM
Here is a proof that it's working.
What was happening was, Mandarine.MandarineCore.setConfiguration is deprecated, it should not be used at all since if it's used, then the configuration will load after Mandarine's engine has loaded which when it gets to that point, it will be pointless to load the view engine from the configuration as it has been loaded already with its default value.
Instead, your configuration file must be name properties.json and it should be located in ./src/main/resources (./src/main/resources/properties.json) Please read this section of the documentation to see more
I am attaching your folder with the properties.json inside the directory it's supposed to be, and also for you to test it out, it should be working properly now.
project.zip

In regards to your second request:

And (not sure if it is and issue on view_engine), but when using denjucks and then extend tag ( {% extend 'some_template.html' %}), it's not using the configured template path, but the project root. So when using the configured path from above, I have to use {% extend 'templates/some_template.html'%}. I could do some more research if you want and open another issue for that.

I am afraid we are unable to do this at the time as it would mean to change everything in the engine just to add that feature. We could work this out if our view engine provider makes the required "infrastructure" for it, I highly encourage you to open a ticket for this in the view engine repository and if they make the changes to support this possible feature, then we could adapt it.

Coming back to the original issue: Please read the documentation I have attached, perhaps test the code that I have attached as well, and let me know if this issue was solved so I can close it.

Regards.

from mandarinets.

ThauEx avatar ThauEx commented on May 8, 2024

Thank you very much. I have not noticed the deprecation of Mandarine.MandarineCore.setConfiguration.
For the scond thing, I will have a look on view-engine and will maybe open an issue there.

from mandarinets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.