How to route to generated Ex_Docs in Phoenix Framework - documentation

I used the ex_docs package to automatically generate documentation regarding my project modules in a Phoenix Framework project.
Then with mix docs I successfully created the doc folder at the root of the project.
However the contained files are full-fledged html files instead of templates.
How can I route to these files with the Router?

The documentation is generated as static HTML files. You can serve static files with phoenix from the priv/static directory, copy your files from doc/ to the static directory.
You can find the configuration for the static file in your endpoint.ex file, see plug for documentation: http://hexdocs.pm/plug/Plug.Static.html.

Related

Is there a way to use Docusaurus just for the /docs directory?

I have an existing website, and just want to use docusaurus to manage the /docs directory (e.g. published as a static site into there). When I follow all the documentation it creates both the docs directory and separate website directory, how can I just have it render /docs when testing locally and only publish that sub-directory when doing a build of the static site?
found the answer in the docs 🤣
https://v2.docusaurus.io/docs/docs-introduction#docs-only-mode

ASP.NET Core with Angular 5 -- When to use the assets folder vs. the wwwroot folder?

When using Angular 5 with ASP.NET Core, a new Visual Studio project contains both a wwwroot folder and an assets folder:
The question is: In which folder should static content (images, css, etc.) be placed, and when would you use one vs. the other?
According to answers online, the wwwroot folder is where static content should go:
The wwwroot folder is new in ASP.NET 5.0. All of the static files in your project go into this folder. These are assets that the app will serve directly to clients, including HTML files, CSS files, image files, and JavaScript files.
However, according to Angular's documentation, static content can also go into the assets folder:
You use the assets array in .angular-cli.json to list files or folders you want to copy as-is when building your project.
All static stuff used and referenced in Angular should go to assets. All static stuff, used in MVC Views, in ASP.NET Core directly should go to wwwroot.
During build/deployment/publish, the built Angular app, will be copied to wwwroot automatically, because this is the root folder for static contents for ASP.NET Core apps. (So the Angular artifacts becomes static contents from the ASP.NET Core view. But you shouldn't need to do this manually.)
Just some additional information on this. I run into a similar situation today while taking a look at an app that my company is about to redesign, I found static files in both wwwroot and assets folders.
Based on the screenshot in the question the project has been created with the Net Core Angular Template that comes with Visual Studio: https://learn.microsoft.com/en-us/aspnet/core/client-side/spa/angular?view=aspnetcore-3.1&tabs=visual-studio (the same template used on the project I was looking at today). By default, you will get a folder structure like this one (screenshot of fresh project attached):
where the favicon.ico is in the wwwroot folder, so you could continue adding images and other static files in the wwwroot folder and the app will work fine. The template is configured to use the folder "ClientApp/dist" in production (Image attached from a fresh project created using the Angular template for .NET Core 3.1) assuming you will serve all as one service.
So, both approaches will work but the assets folder seems to be a better place. That was the place I was expecting to find static files for the Angular app as a developer.
The practical advantage I see from keeping the static files in the Angular project (folder ClientApp/src/assets) is that if you decide along the way to deploy and serve the client app separately you can just grab the angular build which includes the assets folder and move them to the server without additional work.

unable to include external files in a project

I have created the default play application in IntelliJ in directory P. I have over-written the default index.scala.html with my own html code. The html code refers to some css and js files which are outside the directory P. To include these external files, I added the directory of these files using project configuration settings.
My webpage doesn't load properly as the server returns 404 for the css and js files. What am I doing wrong?
When you added your directory using project structure, you only say:
Hey, IDEA, please consider this folder part of my project, consider
its contents source code and display it when I open my project.
However, when you deploy or run your app, you only deploy the usual folders to the server, which contain the resources which will be available for clients to access.
The external directory is not part of these directories and will not be deployed.
What you can do is to copy the file from the external directory as a part of your build process before deploying the application.
EDIT: Detailed answer here: What is intellij's build process for play applications

aurelia bundle - serve from a single directory

Trying to use the aurelia cli bundling facility.
Is it possible to serve all app files (i.e. index.html, app-bundle.html, app-bundle.js, etc) from a single directory or index.html must be at the top (./) directory and the other files in a child (./dist) directory?
Under the covers the cli is using JSPM / System.js's bundling functionality. This works by looking at your config.js paths on where to find the files both for the bundle and when serving. If your paths are set up to serve from the root directory this should work as expected. The problem will be that if you are trying to bundle root it will try to grab all .js files in there which could be bad if you don't exclude them.

ScriptBundle not rendering scripts that are in a VirtualDirectory

I have a modular asp.net app where the modules are deployed inside virtual directories underneath the primary .net web application. We have a common module with a lot of stuff. I tried to move all of the common script files out of each client specific project into a common module.
If I create a script bundle that references files at the root level, it renders the script tag into the html. But it won't render script tags for bundles that point to files in a sub virtual directory.
For example:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/App_Modules/Common/Scripts/jquery-1.*"));
no longer renders any script tag and now I get jquery errors client side. I looked at the resultant html, and now there's no more script tag to download the jquery library.
I had the same problem. The root cause was that I included only minified scripts in the bundle. Once I placed in the scripts directory the uncompressed scripts, it rendered them correctly.
Unfortunately bundling doesn't yet support VirtualPathProviders so if your virtual paths are relying on a VPP to serve the resource, bundling won't be able to find them. This is a scenario we are investigating currently and hopefully will support soon.