Color-code HTML in script templates - visual-studio

I've been using script tags for javascript templates like this. (This example uses Handlebars.js but many other templating engines follow the same convention.)
<script id="template" type="text/x-handlebars-template">
<div>
<span>{{ title }}</span>
</div>
</script>
Visual Studio does not color code the HTML inside the <script> tag. Is there a way to do that?

If the type does not need to be explicitly text/x-handlebars-template, you can use text/html instead. Visual Studio understands this is meant to be interpreted as HTML and will thus color code it appropriately.

Related

how to compile scss styles inside a blade file

I'm trying to use scss styles inside a blade file. but I can't find a propper way to do that.
{{-- header.blade.php --}}
<header id="mainHeader">
<style lang="scss">
.a1 {
color: red;
> .a2 {
font-size: 20px;
}
}
</style>
<div class="a1">
this is a1
<div class="a2">this is a2</div>
</div>
</header>
is there any way to do this?
there is no support for this, you can't compile SCSS from blade templates. Unless you write/use some sort of Plugin for laravel-mix.
In real is just the wrong way to go about it.
I would suggest using normal css in blade.
Sadly, it doesn't seem to be possible within blade.
Vue uses the same setup, where self contained ui components hold html, js and css. Which makes for a very modular system if you plan it correctly.
I've been looking to do something similar to this and just wanted to give anyone in the future a point in the direction I took.
My use case was a little different, we run a bunch of different websites through a tenancy platform and wanted to utilise SCSS to make customisation of the templates easier.
We essentially use blade to create the scss plaintext, and then to compile we use a library called SCSSPHP (https://github.com/scssphp/scssphp/).
When somebody updates their settings on our system, we re-compile their scss for them.

Telerik Hybrid Mobile App Issue showing Japanese chars in View

I am building the HTML5 Hybrid mobile app with the help of Telerik AppBuild platform and in one of the view (components/loginview/view.html) I am trying to show language selection dropdown as follows:
<select data-bind="value: addFormData.languagelist" data-role="dropdownlist">
<option value="en">English</option>
<option value="ja">日本語</option>
</select>
But for my surprise whenever I run the simulator I get the question marks instead of 日本語 characters.
I checked the main index.html file and found that there is proper meta tag like <meta charset="utf-8" /> present needed to set the charset. I am very much new to this dev platform. So appreciate your help.
Try using a different font in your CSS (reference). Whichever font you are using doesn't have support for those characters and just leaves the question marks as placeholders.

How to enable Javascript IntelliSense for HTML DOM reference support in Visual Studio 2010

If you run my code in Visual studio script block you will find out that VS IntelliSense does not list out options(DOM collection select reference) following the script variable named lb and Dot. Unlike VS, adobe DreamWeaver IntelliSense lists out the DOM properties
Any ideas to change or improve this behavior?
Thanks
<script type="text/ecmascript">
function LookUpStock() {
var lb = document.getElementById("ListBox1");
var product = lb.options[lb.selectedIndex].text;
}
</script>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" Runat="server"></asp:ListBox>
<button type="Button" onclick="LookUpStock()">Look Up Stock</button>
</div>
...</form>
ListBox1 is server-side control. Visual Studio can't figure out how it will look when transformed to HTML.
However, if you write
<select id="ListBox1" />
it will show Intellisense

Anyway to make Visual Studio ignore the script tag and assume anything in a script tag is html?

I have a lot of templates that are enclosed within script tags. They are pure html, but Visual Studio grays them out. I don't have any in-line Javascript so if Visual Studio simply ignored the script tag and treated the contents inside as it would a normal html document would be really nice. I've grown accustomed to CSS class intellisense and nice code formatting.
This is a long shot, anyway this is possible? Right now I'm marking up my HTML then putting it within the script tag, but was hoping for a better solution.
You can insert a space after the opening bracket of the opening SCRIPT tag to enable HTML IDE support and when your done, just remove the space.
< script>
^leave space
<div>HTML is supported</div>
</script>
<script>
^no space
<div>HTML is NOT supported here</div>
</script>

Visual Studio 10, JavaScript intellisense inside javascript.js file, and where is the MicrosoftAjax-vsdoc.js

I can get javascript intellisense going from and aspx or master page ie
<script src="../../Scripts/jquery-1.4.1-vsdoc.js"type="text/javascript"></script>
<script type="text/javascript">
$.isFunction(
</script>
gives me a drop down in vs2010.
I do all(most) of my js coding inside a js file.
How do I get intellisense drop downs inside js files ?
Also, is there a vsdoc for ms ajax (MicrosoftAjax-vsdoc.js) ?
At the top of your .js file add this:
/// <reference path="jquery-1.4.1.js" />
Or make the path relative, if it's not in the same directory, it'll look for the jquery-1.4.1-vsdoc.js when grabbing it for intellisense, any file you reference like this it'll look for the -vsdoc version if available. As a side note, jQuery 1.4.2 has additional bug fixes you should consider upgrading :)

Resources