@PitaJ Trying to get the unminified client js and debug the server at the same time.
Qwertyzw
Posts
-
Passing cli arguements to nodebb's child processes -
Passing cli arguements to nodebb's child processesI'd like to pass
--inspect
to the forked app.js process. Right now I'm simply bypassingnodebb
and doingnode --inspect ./app.js
I'd like to be able to do something like
./nodebb nodearg=--inspect dev
is there a way to do this?I've seen other cli tools that implement something like this
gcc <otherArgs> -Xlinker arg <otherArgs>
arg will be passed to the linker child process
-
Debugging frontend js with chrome dev toolsWhat is the ideal way to approach debugging scripts that run on page load?
Javascript loaded from widget areas always runs in an individual VM with no file name reference making breakpoints that are meant to stop scripts that run on page load meaningless, because on every refresh chrome seems to think it's a new resource and gets rid of all the breakpoints.
For some reason I get the same behavior with nodebb.min.js. The breakpoints are all lost on refresh, although the resource name is the same every time (
nodeb.min.js?a-long-id-like-param
)The only way I can think of is to cause whatever is meant to run on a page load to run on some sort of a specific event that is triggered after I got a chance to set the breakpoints. Or simply flood the code with
console.log
s -
Account locked temporarily Issues?I use mongo so I have to follow a different approach to unlock my account
launch your mongo cli, switch to the nodebb db and rundb.objects.remove({"_key":"lockout:YOUR_UID"})
uid is usually 1 for admin
If you don't know what your uid is you can run
db.objects.remove({"_key": { $regex: /lockout:.*/ }})
to unlock all locked accounts
Becareful when doing this as I'm not sure if it would have any other side effects I'm not aware of. It's only meant to be a quick way restore order if you keep locking yourself out during dev
-
Unexpanded tokens in topics list parsed template output. No errorsGot it.
Final code looks like this
app.parseAndTranslate('partials/topics_list', obj, function(jqarr){ var node = document.querySelector('.topic-list') node.innerHTML = jqarr.html() })
-
Unexpanded tokens in topics list parsed template output. No errors@baris said in Unexpanded tokens in topics list parsed template output. No errors:
Check out the method app.parseAndTranslate
Doesn't look like it can work as a drop in replacement for
templates.parse
Could you point me to the documentation/Unminified Source code for this function? How do I use it?
Edit: Managed to get the unminified source by doing
./nodebb dev
(was doingNODE_ENV=development node ./app.js
before -
Unexpanded tokens in topics list parsed template output. No errorsI have an object that has an array of topics
obj = { topics:[ topic1, topic2, topic3 ] }
The topics in this object are sorted in a desired order.
If I dynamically load a template (on the client side) and then
try to use it to render this list usingajaxify.loadTemplate('partials/topics_list', function(temp) { var html = templates.parse(temp, obj ) console.log(html) });
I get html that is exactly what I want but also has things like
[[global:posts]]
and[[category:no_replies]]
. I'm getting the feeling that those were supposed
to be expanded by the parser.Is partials/topics_list expecting obj to have more things other than the
topics: []
and failing (silently?) because of that? Is there a second pass that needs to be invoked
aftertemplates.parse
?Goals: I rolled up a custom list of topics which I'd like to display on the frontend
-
Where is the template parsing logic?@jiangcaiyang I meant to say siblings, the (misleading?) path syntax '../' lead me to saying parent's siblings. I don't mean parsing them either, I only intend to reference them.
-
Where is the template parsing logic?@julian This is what I was looking for for the most part. I think it would be helpful to put this example in the documentation. I just went through the page I linked and found what I was looking for but only after seeing this example.
-
Where is the template parsing logic?Thanks guys. That covers mostly everything for now.
-
Where is the template parsing logic?I can't find decent documentation for it anywhere.
Looked under here https://nodebb.readthedocs.io/en/latest/themes/templates.html,
here https://github.com/NodeBB/NodeBB/blob/master/src/middleware/render.js,All I found was the logic that injects partial templates into each other here https://github.com/NodeBB/NodeBB/blob/master/src/meta/templates.js
But as far as the parsing goes I'm clueless.
What I'm trying to accomplish:
- access parent category's siblings within a .tpl file.
- understand how the pathing logic (eg: {../name}) works
- If the pathing logic is interchangeable with the basic (only?) true/false logic (eg <!-- IF children.length --> ...)
- Once all the questions above are answered, Extend the parsing logic.
- Find a right place to ask these kind of questions.
Thanks