I'm not sure what you're talking about. First of all, public
contains almost entirely unminified source code (the only exception is public/uploads
). build
is where the build artifacts are placed. Secondly, grunt is set to track changes to source files, and ignores files in build
.
...
src/
contains server-side code. public
contains client-side code and a few modules that are shared with the server side. public/less
contains mostly just the styles for the ACP. The actual styles and templates of the forum client are contained within whatever theme you're using. All of these client source files are built into the build
directory.
I would be tempted to open a new topic (maybe Q&A) about the folder structure of the source code (including the files that appear after the ./nodebb setup
) to go into the details of this folders and what pieces of code/styles/templates could each of them contain. A good aanswer would be a good candidate for the Developer FAQ section in my opinion and very helpful. Your comment is helpful and I appreciate providing the info, but it still feels like a large puzzle with details spread throughout the docs and forum topics (some of them old and possibly talking about even pre 1.0 versions-it is hard to tell only by the date of the post)
Even if you accomplish the task of change, you will need to go back and figure out where in the source to reflect the change.
Can you give an example?
...
The whole purpose of grunt is to watch for changes in source files and rebuild and restart when a change is made, building only the assets affected by the change.
...
What did you try? ./nodebb help
will give an overview and ./nodebb help build
will tell you what is available for that command.
I was changing the category.tpl
file to try to customize the look of a post in the category/topic
component and working towards the Example 1 in my original post. And then came across the issue in not finding easily the css
classes referenced in the template file. And finally, the nail in the coffin came from realizing that I find everywhere this component
// modules/components.js
...
'category/topic': function (name, value) {
return $('[component="category/topic"][data-' + name + '="' + value + '"]');
},
...
// src/client/category.js
...
if (!config.usePagination) {
navigator.init('[component="category/topic"]', ajaxify.data.topic_count, Category.toTop, Category.toBottom, Category.navigatorCallback);
} else {
navigator.disable();
}
...
And that my changes require a full compilation since the templates is cached in compiled classes (minified as in not human-readable generated code , but not obfuscated)
// templates/account/topics.js
return "\r\n\t<li component=\"category/topic\" class=\"row clearfix category-item " +
__escape(helper(context, helpers, 'generateTopicClass', [guard(value)])) +
"\" data-tid=\"" +
__escape(guard(context && context['topics'] && context['topics'][key0] && context['topics'][key0]['tid'])) +
"\" data-index=\"" +
I did not manage to trigger grunt
to recompile with my small changes. I am having a hard time distinguishing between source files and generated ones (even when studying the watch
task in Gruntfile.js
to look at folders and files being watched)
Create nodebb-theme-mytheme/templates
git clone
the quickstart theme repo into a directory of your choosing. Then you can rename it to whatever you want and add a templates directory for templates to override. You can then npm link
in the theme directory and npm link <your theme
in the nodebb directory to link your theme into the node_modules for your nodebb. Then it will show up as installed and you can activate it.
I lost the original post that lead me to this link deploy nodebb custom theme, but it talks about the same npm link
solution (only that it uses yarn instead).
My problem was that even now I do not understand where to create this themes folder ("theme directory" cited from your text) and from where to where to create symlinks ("link your theme into the node_modules" cited from your text). It is the same issue I found in the docs when I said is reflects the documentation I am writing for my work projects. It tells the story at the end when you are done with the implementation and it comes from a person that spent a lot of time with it. For you, and maybe for other people, this themes directory is something that you are so used to that it is hard to understand even why I am asking about such an insignificant detail. But I still am uncapable of following your example in cloning a theme simply because I do not know where to put the code that I pulled via a git clone
of the base theme repo or what symlinks to deploy - since I have the impression that your answer is that is not important where I put it, but that I symlink to the correct place in the end and the node resolution mechanism will find my code if it symlink-ed somewhere in the node_modules
folder - and that I should just place it the root of an even fake node module like node_modules/my_fake_symlinked_even_module/themes
.
I'm not exactly sure what you want, but it sounds like you want to show a list of the latest N topics from the set of subcategories C. Since a topic is only associated with one category, not with a category hierarchy, you'd need to grab the latest N topics from each of the subcategories, then sort them by timestamp, then grab the top N. So it may not be very scalable, just because of how they're stored in the DB. There are several ways around this but they'd require varying degrees of difficulty and compromise.
Regarding use case of Example 1:
It is a forum about developments of infrastructure projects for people interested in following or working in the field. Saying that one topic would be Highway B11
with 500km planned and broken into 10 smaller segments with a timeline stretched over 6-7 years. You end up with thousands of small comments all related to the same topic. It resembles an news website, only that the community is the one building the news and there is not a single source. On the plus side you can comment like you would on any news website and you can exchange ideas in the community (unlike a typical blog page/news website where everyone can comment and you do not have community, but rather followers )
I want to break this topic into smaller topics, i.e. a topic would be a drone video of a bridge that is built on 2nd March, followed by a topic with the results of the public auction for the last segment, a topic about how the plans did not include an overpass at X location, etc. All of this I called anonymous topics since the title is not important as they are in fact part of the same larger topic, but the focus is the content.
In a full linear (timeline comments) forum, this conversations become an issue if you keep a single topic for all of them (imagine all 3 updates coming at the same time - people will respond to each of them and the comments get interlaced and the conversation becomes hard to follow)
Regarding use case of Example 2.
The same forum where you have a category of Highways
and subcategories Highway B1
, ... Highway B100
. The category Highway
should not even contain topics, but you would like to show all the updates from all subcategories (i.e. individual highways) made. Most people would like to hear about all the updates (anyway, true and impactful updates are 1-2 every day across all of the highways). In case you want to dive deeper in a particular highway you go into the respective subcategory. On top of this you would have another category named Road infrastructure
that contains Highways
and National Roads
, and the same argument is valid that you would want to see topics (updates) here from both subsections.
At the moment the only solution is to have a category Road infrastructure
that contains subcategories Highways
and National Roads
. Highways
contains 100 topics named Highway B1
, ... Highway B100
, each of them 1000+ comments long and with interlaced and messy conversations (actually it does not even encourage commenting and makes it act like a news website with many authors, but no comment section ). Here is an example forum that it is aimed at this and faces this issues forum.peundemerg.ro (it is not English based but I chose a place to get a feel of the issue - you might notice the 1611 page of the topic)