Giter VIP home page Giter VIP logo

Comments (24)

aredridel avatar aredridel commented on September 1, 2024

I'd love to know what your config looks like -- things moved around a bit.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Thanks, here is my current config.json:

{
  "express": {
    "view cache": false,
    "view engine": "dust",
    "views": "path:./.build/templates"
  },

  "view engines": {
    "dust": {
        "module": "makara",
        "renderer": {
            "method": "dust",
            "arguments": [
                { "cache": false, "helpers": "config:dust.helpers" }
            ]
        }
    }
  },
  "bundle engine": "dust",
  "specialization": "import:./specialization.json",
  "i18n": {
    "contentPath": "path:./locales",
    "fallback": "en-US"
  },
  "databaseConfig": {
    "host": "localhost",
    "database": "shocart"
  },
  "dust": {
       "helpers": [
           "dust-makara-helpers"
       ]
   },
  "paypalConfig": {
    "host": "api.sandbox.paypal.com",
    "port": "",
    "client_id": "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
    "client_secret": "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM"
  },
  "middleware": {
    "expressView": {
            "priority": 100,
            "enabled": true,
            "module": {
                "name": "makara",
                "arguments": [
                    {
                        "i18n": "config:i18n",
                        "specialization": "config:specialization"
                    }
                ]
            }
        },
    "static": {
      "module": {
        "arguments": [ "path:./.build" ]
      }
    },

    "router": {
      "module": {
        "arguments": [ { "directory": "path:./controllers" } ]
      }
    },

    "fileNotFound": {
      "enabled": true,
      "priority": 130,
      "module": {
        "name": "kraken-js/middleware/404",
        "arguments": [ "errors/404" ]
      }
    },

    "serverError": {
      "enabled": true,
      "priority": 140,
      "module": {
        "name": "kraken-js/middleware/500",
        "arguments": [ "errors/500" ]
      }
    },

    "locale": {
      "priority": 95,
      "enabled": true,
      "module": {
        "name": "path:./lib/locale"
      }
    }
  }
}

And the specialization.json file:

{
    "noprods": [
        {
            "is": "shopsite/noprods",
            "when": {
                "template.is": "shopsite"
            }
        }
    ]
}

I am passing the config like this:

 model.template = {
    is: "shopsite"
};

res.render('index', model);

And before the upgrade shopsite/noprods.dust was getting rendered, now only ./noprods.dust seems to come up.

from makara.

aredridel avatar aredridel commented on September 1, 2024

Hrm. At a glance that looks right -- you don't need the indirection of using both import: and config: handlers, you could just import it right into the config, but I see no error there.

Can you run your app with the NODE_DEBUG=engine-munger environment variable? That should print out debug tracing and show where it went wrong.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024
ENGINE-MUNGER 14116: specialization mapped 'index.dust' to 'index.dust'
ENGINE-MUNGER 14116: lookup "index.dust"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 14116: render "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 14116: specialization mapped 'index.properties' to 'index.properti
es'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "index.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\index.properties"

ENGINE-MUNGER 14116: specialization mapped 'index.properties' to 'index.properti
es'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "index.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\index.properties"

ENGINE-MUNGER 14116: specialization mapped 'layouts/master.dust' to 'layouts/mas
ter.dust'
ENGINE-MUNGER 14116: lookup "layouts/master.dust"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\public\templates\layouts\master.
dust"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\public\templates\layouts\master
.dust"
ENGINE-MUNGER 14116: specialization mapped 'layouts/master.properties' to 'layou
ts/master.properties'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "layouts/master.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\layouts\master.pr
operties"
ENGINE-MUNGER 14116: specialization mapped 'layouts/master.properties' to 'layou
ts/master.properties'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "layouts/master.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\layouts\master.pr
operties"
ENGINE-MUNGER 14116: specialization mapped 'noprods.dust' to 'noprods.dust'
ENGINE-MUNGER 14116: lookup "noprods.dust"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\public\templates\noprods.dust"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\public\templates\noprods.dust"
ENGINE-MUNGER 14116: specialization mapped 'noprods.properties' to 'noprods.prop
erties'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "noprods.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\noprods.properties
"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\noprods.propertie
s"
ENGINE-MUNGER 14116: specialization mapped 'noprods.properties' to 'noprods.prop
erties'
ENGINE-MUNGER 14116: trying locales ["US/en"]
ENGINE-MUNGER 14116: lookup "noprods.properties"
ENGINE-MUNGER 14116: stat "M:\web\node\webtrade\locales\US\en\noprods.properties
"
ENGINE-MUNGER 14116: found "M:\web\node\webtrade\locales\US\en\noprods.propertie
s"

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

if I put {template.is} into the index.dust file it shows the value of "shopsite", which should trigger the alternate partial if I have all the bits lined up correctly.

from makara.

aredridel avatar aredridel commented on September 1, 2024

Oh! I bet I know what it is. Change your specialization map to include the extension on the filename of the template.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Thanks, but still the same (but different) - there's a lot of 404 stuff in the debug log now, but the rendered output looks the same.

ENGINE-MUNGER 3888: specialization mapped 'errors/404.dust' to 'errors/404.dust'

ENGINE-MUNGER 3888: lookup "errors/404.dust"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\public\templates\errors\404.dust"

ENGINE-MUNGER 3888: found "M:\web\node\webtrade\public\templates\errors\404.dust
"
ENGINE-MUNGER 3888: render "M:\web\node\webtrade\public\templates\errors\404.dus
t"
ENGINE-MUNGER 3888: specialization mapped 'errors/404.properties' to 'errors/404
.properties'
ENGINE-MUNGER 3888: trying locales ["US/en"]
ENGINE-MUNGER 3888: lookup "errors/404.properties"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\locales\US\en\errors\404.properti
es"
ENGINE-MUNGER 3888: found "M:\web\node\webtrade\locales\US\en\errors\404.propert
ies"
ENGINE-MUNGER 3888: specialization mapped 'errors/404.properties' to 'errors/404
.properties'
ENGINE-MUNGER 3888: trying locales ["US/en"]
ENGINE-MUNGER 3888: lookup "errors/404.properties"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\locales\US\en\errors\404.properti
es"
ENGINE-MUNGER 3888: found "M:\web\node\webtrade\locales\US\en\errors\404.propert
ies"
ENGINE-MUNGER 3888: specialization mapped 'layouts/master.dust' to 'layouts/mast
er.dust'
ENGINE-MUNGER 3888: lookup "layouts/master.dust"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\public\templates\layouts\master.d
ust"
ENGINE-MUNGER 3888: found "M:\web\node\webtrade\public\templates\layouts\master.
dust"
ENGINE-MUNGER 3888: specialization mapped 'layouts/master.properties' to 'layout
s/master.properties'
ENGINE-MUNGER 3888: trying locales ["US/en"]
ENGINE-MUNGER 3888: lookup "layouts/master.properties"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\locales\US\en\layouts\master.prop
erties"
ENGINE-MUNGER 3888: found "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"
ENGINE-MUNGER 3888: specialization mapped 'layouts/master.properties' to 'layout
s/master.properties'
ENGINE-MUNGER 3888: trying locales ["US/en"]
ENGINE-MUNGER 3888: lookup "layouts/master.properties"
ENGINE-MUNGER 3888: stat "M:\web\node\webtrade\locales\US\en\layouts\master.prop
erties"
ENGINE-MUNGER 3888: found "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"

My spec file is now

{
    "noprods": [
        {
            "is": "shopsite/noprods.dust",
            "when": {
                "template.is": "shopsite"
            }
        }
    ]
}

from makara.

aredridel avatar aredridel commented on September 1, 2024

try

{
    "noprods.dust": [
        {
            "is": "shopsite/noprods.dust",
            "when": {
                "template.is": "shopsite"
            }
        }
    ]
}

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024
ENGINE-MUNGER 3300: specialization mapped 'index.dust' to 'index.dust'
ENGINE-MUNGER 3300: lookup "index.dust"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 3300: render "M:\web\node\webtrade\public\templates\index.dust"
ENGINE-MUNGER 3300: specialization mapped 'index.properties' to 'index.propertie
s'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "index.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 3300: specialization mapped 'index.properties' to 'index.propertie
s'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "index.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\index.properties"
ENGINE-MUNGER 3300: specialization mapped 'layouts/master.dust' to 'layouts/mast
er.dust'
ENGINE-MUNGER 3300: lookup "layouts/master.dust"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\public\templates\layouts\master.d
ust"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\public\templates\layouts\master.
dust"
ENGINE-MUNGER 3300: specialization mapped 'layouts/master.properties' to 'layout
s/master.properties'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "layouts/master.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\layouts\master.prop
erties"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"
ENGINE-MUNGER 3300: specialization mapped 'layouts/master.properties' to 'layout
s/master.properties'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "layouts/master.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\layouts\master.prop
erties"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\layouts\master.pro
perties"
ENGINE-MUNGER 3300: specialization mapped 'noprods.dust' to 'noprods.dust'
ENGINE-MUNGER 3300: lookup "noprods.dust"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\public\templates\noprods.dust"
ENGINE-MUNGER 3300: found "M:\web\node\webtrade\public\templates\noprods.dust"
ENGINE-MUNGER 3300: specialization mapped 'noprods.properties' to 'noprods.prope
rties'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "noprods.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\noprods.properties"

ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\noprods.properties
"
ENGINE-MUNGER 3300: specialization mapped 'noprods.properties' to 'noprods.prope
rties'
ENGINE-MUNGER 3300: trying locales ["US/en"]
ENGINE-MUNGER 3300: lookup "noprods.properties"
ENGINE-MUNGER 3300: stat "M:\web\node\webtrade\locales\US\en\noprods.properties"

ENGINE-MUNGER 3300: found "M:\web\node\webtrade\locales\US\en\noprods.properties
"

With spec file:

{ "noprods.dust": [ { "is": "shopsite/noprods.dust", "when": { "template.is": "shopsite" } } ] }

Same rendered output as before

from makara.

aredridel avatar aredridel commented on September 1, 2024

Well nuts! that should work!

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

This is running on Windows Server 2012 with latest node.js if that helps

from makara.

aredridel avatar aredridel commented on September 1, 2024

I'll have to try later -- I've my job to get to at the moment, but I may see if I can delve into this in the kraken specialization sample app and upgrade that to makara 2.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Ok cool, yes it would be good to have a standard example to work with. Can confirm a rollback to earlier code works as expected on the same machine.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Quick question (I'm still a bit of a node noob) is it possible to have a dynamic specialization, so that the controller defines the mapping so I don't need to restart the app every time I make a change?

from makara.

aredridel avatar aredridel commented on September 1, 2024

Not as it stands -- might be able to tweak the map if you can get a reference to it, but I'd have to see if it's cleanly exposed or not.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Ok thanks, have had a quick look and can see it being assigned in engine-munger but any hints or tips as to when and where to hook into the render process would be welcome :)

from makara.

aredridel avatar aredridel commented on September 1, 2024

I'm up to my elbows in the guts right now and it looks like the main templates should be working properly, but partials aren't passing the full information, and therefore aren't being specialized.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Yes, that sounds like what was happening

from makara.

aredridel avatar aredridel commented on September 1, 2024

So yes, I can confirm this is a bug. It's actually a bug in adaro, which should be fixed by krakenjs/adaro#92

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Cool, great, thanks for fixing it so fast :) What do I need to do to test it? Can I do an npm update, or manually patch the code my side?

from makara.

aredridel avatar aredridel commented on September 1, 2024

You can install the module from the git branch to test, or apply my changes -- they're simple -- to your existing copy.

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

ok I'll apply your changes directly. Also I'm very keen on setting up dynamic specialization if you have any pointers in that regard. Thank you very much for your help.

from makara.

aredridel avatar aredridel commented on September 1, 2024

kraken is going to fight you a bit on the dynamic specialization. It does a bit of extra work to keep people from using the config as a data store shared among modules -- so mutating it is hard.

How hard on your workflow is it to just restart the server on change with something like nodemon?

from makara.

Ampakinetic avatar Ampakinetic commented on September 1, 2024

Ok thanks I'll give that a go, I haven't used nodemon before, so appreciate the tip

from makara.

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.