Skip to content

New+ mustache and options #36306

Open
@legopitstop

Description

Description of the new feature / enhancement

Add mustache templating to New+ templates.

Templates could have a config file (NewPlus.yml) that contains options like GitHub issue forms. The config file could be located in a .powertoys subfolder so users can add support.

When you create a template with a config file it will open a UI with these options.

Example

Template structure

📁My Template/
├── 📁.powertoys/
│   └── 📃NewPlus.yml
├── 📃package.json
└── 📁src/
    ├── 📃template.html
    └── 📃main.js

NewPlus.yml

name: "Name to show in context menu"
description: "An example new+ config"
body:
- id: name
  type: input
  attributes: 
    label: Name
- id: version
  type: input
  attributes: 
    label: Version
- id: description
  type: textarea
  attributes: 
    label: Description
# Files that should not render.
# For when your project uses mustache
norender:
- src/template.html

package.json

{
   "name": "{{ body.name }}",
   "version": "{{ body.version }}",
   "description": "{{ body.description }}",
   "license": "MIT",
   "main": ".src/main.js",
}

src/main.js

const NAME = "{{ body.name }}";
const VERSION = "{{ body.version }}";

console.log("Loading "+ NAME + " v" + VERSION);

src/template.html

This file will not be rendered.

{{string}} {{#emphasize}}{{nested.string}}{{/emphasize}}
<ul>
    {{#list}}
    <li>{{.}}
    {{/list}}
</ul>

Example window when creating the template from the context menu.

Image

Scenario when this would be used?

The current New+ behavior is just making a copy of the template. This feature would allow more flexibility and customizability

Supporting information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Idea-EnhancementNew feature or request on an existing productNeeds-TriageFor issues raised to be triaged and prioritized by internal Microsoft teamsProduct-New+Refers to the New+ PowerToys Utility

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions