Skip to content

WebAppsAndFrameworks/VS-Templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Templates for Visual Studio

The templates are also available as a VSIX in the Visual Studio Gallery

Contents

## BlankTemplate The `Blank Template` is about as barebones as it gets. The primary goal of this template is to make it clear that developing a Windows JavaScript App is no different than developing a standard WebApp.

The HTML file is essentially a plain HTML document:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>$safeprojectname$</title>
  <link href="css/default.css" rel="stylesheet" />
</head>
<body>
  <div>Content goes here!</div>
  <script src="js/main.js"></script>
</body>
</html>

JS

The JavScript file is completely empty. It just contains a comment

// Your code here!

I played with using onload and DOMContentLoaded events, but decided against it—it's simpler to keep the script at the bottom of the <body> tag. This seems to account for the largest number of scenarios and is the easiest for developers to understand.

I've also removed the IIFE. A developer who knows what they are can easily add it themselves, and it could add unnecessary confusion for a newer developer.

CSS

The CSS file is essentially also blank. It just contains a body selector with the ability to uncomment out a line to enable scrolling and zooming in a WWA.

body {
  /* Uncomment this to enable scrolling and zooming
  touch-action: manipulation;
  */
}

I am considering having this file completely blank and renaming it to style.css.

## BlankTemplate (Web Context) This is the same as the above, except with `ms-appx-web:///` ## HostedTemplate The Hosted App format is different enough from a packaged app that having a template for it does add some value.

This is the biggest reason having a template for Hosted Apps is important. In the Blank Template, the <uap:ApplicationContentUriRules> section is not neccessary. However, it is required for Hosted Apps to work.

Currently, the manifest included in the template includes a remote start page:

<Application
  Id="App"
  StartPage="https://example.com">

and ACURs:

<uap:ApplicationContentUriRules>
  <uap:Rule Type="include" WindowsRuntimeAccess="all" Match="https://example.com" />
</uap:ApplicationContentUriRules>

The project also contains msapp-error pages.

Something I'd like to potentially try out would be potentially having the StartPage point to some type of tutorial or documentation for Hosted Apps.

## WinJS Template The WinJS template is mostly the same as the old default template. We want to make sure developers understand that it is not necessary to use WinJS in order to develop a JavaScript app on Windows.

The index.html file has been updated to include the win-type-body class on the <body> tag. This was one of the breaking changes from WinJS.

About

JavaScript Templates for Visual Studio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published