How to deploy prod bundled Polymer 3 app build? - polymer-3.x

In my case polymer app or custom element should be deployed to Springs MVC jsp page.
I've expected bundled build will produce a couple of files that should be included in production similar as it is done in case of Angular 2+. But, Polymer put bundled code to script tags in index.html file.
How should that "output" be deployed to existing non page in production?

Related

Does Asp.Net Core 3.0 cache views/output differently than version 2.2?

I started noticing an issue in my development setup earlier today, that I've never seen before.
I have an Asp.Net Core application with a default route serving a javascript bundle built with webpack. This default route uses a view called Index.cshtml.
Index.cshtml is automatically generated by webpack from a different file, using the webpack plugin HtmlWebpackPlugin. Every time webpack rebuilds the bundle, it overwrites Index.cshtml with a new version, containing a script tag that points to the freshly built bundle.
The Asp.Net application runs inside a docker container, but Visual Studio automatically mounts the applications root folder to the corresponding folder on the host, so static files can be updated without needing to rebuild the container.
This setup has worked for over a year until today.
Now, for some reason, when a new bundle is built, the resulting HTML that comes out of Asp.Net still points to the old bundle. At first, I thought there was a problem with the disk mount. However, when I attach to the running container and have a look at Index.cshtml from inside the container, it looks correct (meaning it points to the fresh js bundle).
I upgraded from Asp.Net core 2.2 to 3.0 about a week ago, and I suspect that this is related. I can't find any information on the web that suggests that output caching or view caching works differently by default compared to version 2.2, but I might have missed something.
Anyone has an idea what the problem might be?
For anyone experiencing the same issue:
As #itminus commented, in order to support runtime compilation of razor views, you need to add a reference to Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and run
services
.AddControllersWithViews()
.AddRazorRuntimeCompilation();
in ConfigureServices.

ASP.NET Core 2 + Angular -> how set up VSTS?

I have my ASP.NET Core + Angular WebApp uploaded to GitHub(through VSTS) and now I would like to set up the CI pipeline. After that I would like to deploy my app to Azure.
In the template section - there is an ASP.NET Core template, but also an Azure Web App template.
Considering my case which is better suited for this case?
I found the almost perfect working answer in Levi Fuller's blog.
You can get it working with a minor change: unlike what Levi states, you really need only a single npm task
set up the npm task
by clicking the three dots button -> set the Working folder with package.json to your folder that contains the package.json file.
set up the Azure App Service Deploy
by clicking the three dots button -> set the Package or folder to your folder that contains the .csproj file.
There isn’t the build template that you use directly, the template is convenient to use, you need to modify it per to detail requirement.
Refer to these steps:
Go to build page of team project (e.g. https://XXX.visualstudio.com/[teamproject]/_build)
Click +New button to create a build definition with ASP.NET Core template
Add npm install task before .NET Core Restore task (Command: install; Working folder with package.json:[package.json folder path])
(optional) Delete/disable .NET Core Test task if you don’t need
Add Azure App Service Deploy task at the end (Package or folder: $(build.artifactstagingdirectory)/**/*.zip; Check Publish using Web Deploy option)
Note: you can move step 4 to release and link this build to release (change package or folder to $(System.DefaultWorkingDirectory)/**/*.zip).

Include Css Intellisense from one project in another

I have multiple web apps running on a server that all use a lot of the same css/image files. In order make everything more centralized i've taken all of the files out of the projects and wrote a small static file server in asp.net core with some gulp tasks to manage the css. The goal was to have it act like a cdn (with only one machine) and serve some other api functions, but to work locally without internet access.
I figured that if i included the visual studio project in the solutions for my other projects they would have access to the css/scss files for intellisense, which was not the case.
Is there some way that i can reference the files in visual studio so that i can get auto completion in the apps' view files?
I solved this problem by creating a symbolic link that included the assets in the desired project.

Can I bundle and migrate a standalone Aurelia App that can run on apache server without node.js?

First of I am new to Aurelia and has just completed a real world project on my development server which I like to run concurrently with WordPress which needs PHP. Back in the days with angular 1.x I used to gulp all the angular dependencies and scripts into a single file and transfer it to the server, which I thought would be the case with Aurelia too but looks like it is more complex in this matter. So please if any one has come around to this problem, any help would be appericated like how can I port Aurelia project to apache server without serving it through node. Or is it possible to run node and apache on same server.
You don't need to run Node to serve your application. Any web server - such as Apache - will do. You only need to bundle your application and upload the files to your server.
If your project was created using the CLI, the application is bundled automatically every time you run au run (or au build), so you can simply upload the scripts directory and the index.html file. This is the minimum; you may need to upload also CSS, images or fonts, depending on your app.
If your project is based on one of the skeletons, you can bundle your app by running gulp bundle, then upload the distdirectory, the jspm_packages directory, the config.js file and the index.html file, plus anny other asset (CSS, images, etc.) you may need.

Adding grunt output directory to ASP.NET web service

I am creating a javascript webApp and i deploy it using GruntJS. this web app will be deployed in an ASP.NET MVC Web Service. I want to add the dist folder (and any files created by grunt inside the folder) programmatically inside the visual studio project, so when I build and deploy the web service I can navigate to this folder. Hope I was clear!
Yes you can. Grunt is completely independent of IDEs and texteditors and is a really helpful tool for all kinds of web development in any editor.
Grunt is described as “a node based javascript task runner with which you can automate tasks like minification, compilation, unit testing, linting and more”. You can use it for example when you do not like to be dependent on an asp.net web server doing minification and bundling for you, or you simply like to be able to use tools that are not (yet) supported by the asp.net/Visual Studio ecosystem.
Here is all you need: http://joeriks.com/2013/08/06/can-i-benefit-from-grunt-for-my-visual-studio-based-web-development/
Hope this helps!
Try to tweak WebDeploy settings in your MSBuild file (*.csproj?) so it would include files from the dist folder into your web application during publishing.
The following tutorial should be a good starting point how to do it:
http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
Also check ASP.NET Solution Template on Visual Studio Gallery

Resources