create mhtml from html and javascript files in asp.net core - mhtml

I have HTML file and associated javascript, CSS and images I need to convert them into single MHTML file in asp.net core Is there any way to do the same

Related

Base code/folder structure for SharePoint Framework SPFx using React

I am new for SharePoint SPFx and React. I am searching for best practice code structure for SharePoint SPFx development using React. Basically I am looking for the code structure where I can put components, models, services and html files in separate folders.
How to use HTML templates file from folder name templates into component file (.tsx)
I have created new folder name 'common-library' inside root folder 'src' and putting all common/shared code like base configurations, models, services in separate folder which can be used in any webpart and react component.
Base code/folder structure
You can check complete code here.

In a rails, where does one place a bundled React JS file that will be referenced by a single view?

I need to place a single my_custom_app.js file (a bundled-with-webpack React app) somewhere inside the default project structure of a Rails app.
Then I plan to reference said file only from a single view (
app/views/dashboard/index.html.erb).
I think that I don't need this file to be part of the asset pipeline. I would like Rails to version it's filename by adding that hash but I definitely don't want it concatenated with the rest of the JS of the site.
Any ideas?

What's the correct way to structure a project in ASP.NET MVC with an Angular SPA inside it?

I have an ASP.NET MVC project that will have an Angular SPA inside it. At first, I decided to create a new Area for the SPA but then I realized that I'm not going to use any Models or Controllers inside the area but just JavaScript files. So, now my idea is to place all the scripts for the SPA in the main ~\Scripts\ folder of the ASP.NET MVC project but inside another folder ~\Scripts\MySPAName\ and load the SPA just trough a ASP.NET MVC View.
What's the best way to structure a project in this scenario?
Well, if you want to create such kind of project I suggest you use MVC + WebAPI + Angularjs. You really need only 2 MVC controllers: Account for all login/logout logic and Home with only one simple method Index This Index method returns view which contains only one line of code - div or section or whatever you want ng-view attribute. This will be your main application page. Why its better to use WebAPI? Because these controllers works faster than MVC ones and WebAPI provide you with great REST possibility. What bout project structure. I can suggest you my personal structure of MVC + Angularjs project:
So you have API folder for WebAPI controllers, standard Controllers folder for MVC controllers. In Scripts folder you have separate folders for your angular controllers services ang general libraries and one .js file - its your angular module and application file. Moreover, its better and cleaner if you have additional subfolders in Scripts/Controllers folder so you can split all you *.js file by category (e.g Home, Mangers, Prices etc). Also you can see that I have folder Templates in root of my project. Here you can place all your html files which you will use as angular views/templates. And I also suggest you to create additional subfolders here as in Scripts/Controllers subfolder for better and cleaner structure
Hope that will help you
ASP.NET MVC is better suited to traditional web sites. For a single page app, use ASP.NET Web API instead. Here's a tutorial:
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/build-a-single-page-application-(spa)-with-aspnet-web-api-and-angularjs
In this, There are two web projects, one is or web api and another one is for client web page (SPA).
You just need a empty web project to start an angular project.
Index.html - It is the main html page for your application. All other pages (partial pages) for your project can be placed Inside the directory Pages.
Scripts - All your js files can be placed inside this directory. You can differentiate all your js files into it's sub-directories.

Change Angularjs existing backend to Play 2

I have a fully developed Angularjs frontend app (with the routes and everything set up) and would like to change the current backend to a Play 2 Java. What is the best approach to display the existing html files from Angular in Play? I have found a few examples of how to connect the routes, but I would rater not create an index.scala.html file as I would like to have the two frameworks separated as much as possible and having Play only working as backend.
If you don't want to dynamically generate views from Play using Twirl and you just want to serve your HTML static files publishing them as assets is the way to go. By default assets are designed to provide resource like CSS or JS files but nothing prevents you from serving ordinary HTML views as well.
Simply put your index.html in the public directory and modify the conf/routes files so it can handle all requests:
GET /*file controllers.Assets.at(path="/public", file)
This way your index.html will be accessible at www.yourdomain.com/index.html. Remember to put this line as the last mapping in the file as it matches all possible URLs. Other services should be declared above it.

Using AngularJS in local HTML

What are the best practices for using AngularJS in local HTML? By that, I mean HTML files opened directly from the local file system, not from a web server.
I have had some luck in replacing partials that are in separate files with partials within script tags. And replacing Ajax calls with including JS files that contain the JSON data. However, I wondered if there are any guidelines for doing this, or even helper libraries?
BTW, my use case is a desktop application that generates HTML reports that are server using a local web server. In some cases users want to create a ZIP file that contains an HTML report, which they can email to someone else. Given the sensitivity of these reports, people may have objections to using a cloud service. Having HTML in a zip file gives them control of their data.

Resources