mix razor view with handlebar templates - razor

I'm using ASP MVC with Razor view engine to build web application.
I'm also using EmberJS on some views for client side rich application framework.
EmberJS uses handlebar templates.
The problem is that visual studio lose the ability to color-code the HTML elements inside the handlebar script tab like so:
<script type="text/x-handlebars">
<div>
<div>#ShowRes.NumberOfNodesInNetwork: {{App.nodesController.arrangedContent.length}}</div>
<div>#ShowRes.NumberOfLinksInNetwork: {{App.linksController.arrangedContent.length}}</div>
</div>
</scrtip>
The div element inside the script tag is not color-coded.
Any idea how to cause VS2012 to ignore the script tag and simply treat the HTML elements as if no script element exist?

It looks like that without custom plugin for visual studio it is not possible to get syntax highlight inside handlebar template.

Related

Extract Angular components to plain HTML + CSS

I have an angular app that I need to use as a source of the components for my new app that will be mostly using pure HTML. I need to get the HTML and CSS from the Angular app.
The problem is, that the app uses custom components such as <mat-icon> that are not standard HTML tags. I assume, that under the hood they eventually consist of simple HTML elements but I can't figure it out. Is there any method to convert an Angular website to plain HTML & CSS? I know that the dynamic content can't be extracted, but I mean only the view. Maybe there is a Chrome extension to do that? I do have access to the app source code, so it can be also some npm module.

Angular 7: Dynamically generate template

I'm rewriting my website https://ixtutor.com/ completely in angular. I've created few components that render as widgets on a blog page.
For example, on a blog post https://ixtutor.com/tensorflow-basics-with-housing-prices-prediction-example-chapter-i/ , there are widgets like,
(i) Code runner widget
(ii) Exercise widget
I'm modeling these widgets as components in my angular application.
Problem: One of the page in my application is a live html editor, which allows an author to write the (angular) html templates in a textarea T1 and see the (rendered) view side-by-side. I also want the author to be able to use the widget components in the html that they create.
This works great with regular html tags, where I can use the innerHTML property of a div to directly bind the ngModel of the textarea T1, however, it doesn't work for the angular components.
I've looked at dynamic angular components but I cannot figure out how to use that in a full-fledged html template. Any recommendations or suggestions will be really appreciated.
Thanks.
Angular does not support inserting dynamic components in the template at runtime. It has to know at compile time which components will be inserted.
The only way is to compile your Angular components to web components using Angular elements, that way, you will be able to insert them as custom HTML elements in your application.
You will have to develop them in a separate library for this.

HTML email template builder using Delphi

I want to build an interactive html page builder using drag n drop.
Basically it will have elements like image, section, text etc which a user can use to build a HTML page.
Any suggestions for third party Delphi components which I can use for HTML editor?
Have a look at HTML Component Library. It includes an editor. Check this blog post for an introduction HTMLComponents, the native Delphi html rendering engine

Is there a way to add a designer view for the cshtml razor editor?

I am using an inhouse tool we developed to parse razor templates with generated models.
The thing is that now it requires loading the template every time in order to parse it.
I wanted to add an edior so i could preview the cshtml while writing it, so i thought the best way would be to make it a visual studio extension.
I researched the web and it seems to me like you can write a custom editor for VS, but then I have to write the editor itself, which i dont want to do.
Is there a way to use the existing razor editor built in to VS2012 and add a preview tab with my control that gets the current text from the razor editor so i can parse it and show the preview?
The reason want to use the existing editor is for coloring, intellisense, error handling etc.
There is no built-in support for a design view for Razor (CSHTML and VBHTML) files. Part of the reason for this is that they are a mix of code and HTML, which ranges from "very difficult" to "super impossible" to parse.
Having said that, there's a super cool feature in VS2012 called Page Inspector that can show you the real rendered page alongside the code that generated it (e.g. your Razor view) and the mappings between them, even if some of the content came from a layout page or partial view.
Check out http://msdn.microsoft.com/en-us/library/hh420390(v=VS.110).aspx and look for the "Page Inspector" section, which includes links to several blog posts and videos that describe the feature in depth.
Here's an excerpt:
Page Inspector is a tool that renders a web page (HTML, Web Forms, ASP.NET MVC, or Web Pages) directly within the Visual Studio IDE. You can use Page Inspector to examine both the source code and the resulting output. For ASP.NET pages, you can use Page Inspector to determine which server-side code has produced the HTML markup that is rendered to the browser. Page Inspector works even when the default ASP.NET bundling and minification features are enabled.

How to use HTML template with Vaadin?

I am new to Vaadin.
I have created template for my web application in HTML and JS.
How to use the developed template with Vaadin as am not sure if I will be able to develop same template using Vaadin only?
It may be possible to re-use some of the layout of the template using the CustomLayout layout component in Vaadin.
You can also render the contents of a template into a Label component, and display the label in the application. See http://demo.vaadin.com/sampler#LabelRich for a small demo.
Generally, though, the idea of templates and "pages" is orthogonal to developing applications in Vaadin.