GithubHelp home page GithubHelp logo

douglaszaltron / nunjucks-vscode-extensionpack Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 271 KB

This is the nunjucks supporting extension for vscode with complete features.

License: MIT License

TypeScript 100.00%

nunjucks-vscode-extensionpack's Introduction

Nunjucks Visual Studio Code Extension Pack

This is the nunjucks supporting extension for vscode with complete features.

vscode-nunjucks support these file extensions

.nunjucks, .nunjs, .nj, .njk, .html, .htm, .template, .tmpl, .tpl

snippets

Prefix HTML Snippet Content
block {% block name %} {% endblock %}
{% {% %}
{{ {{ variable }}
extends {% extends "template" %}
include {% include "template" %}
filter {% filter filter %} {% endfilter %}
for {% for item in sequence %} {% endfor %}
asyncEach {% asyncEach item in sequence %} {% endeach %}
asyncAll {% asyncAll item in sequence %} {% endeach %}
if {% if condition %} {% endif %}
ife if else
ifel if elif
elif elif
else else
set set
macro macro
import import
from from import
raw raw
call call
var alt variable
super super
or or
pipe pipe

Install extension in marketplace (recomended method)

To install extension directly from VSCode you need to proceed with theese four simple steps:

  1. Go to View > Command Palette (Mac OSX: cmd+shift+P, Windows: ctrl+shift+P)
  2. Run the following command in the Command Palette field: >ext install extension and hit enter.
  3. Then type nunjucks-vscode-extensionpack and hit enter.
  4. After instalation is complete restart the Code app and you are all set up for start writing nunjucks templates in VSCode.

install extension manually

To install extension manually you need to proceed with theese five steps:

  1. Download this nunjucks-vscode-extensionpack repo from GitHub
  2. Navigate to the <user home>/.vscode/extensions directory on your computer.
  3. Create a new folder and name it nunjucks-vscode-extensionpack
  4. Copy all content of this repository into the <user home>/.vscode/extensions/nunjucks-vscode-extensionpack directory.
  5. Restart the Code app and you are all set up for start writing nunjucks templates in Code.

Settings

{
    "html.suggest.html5": true,
    "emmet.includeLanguages": {
        "njk": "html"
    },
    "files.associations": {
        "*.njk": "njk"
    }
}

nunjucks-vscode-extensionpack's People

Contributors

douglaszaltron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jeffvolt lsabella

nunjucks-vscode-extensionpack's Issues

Formats with excessive indentation

For some reason, this extension creates excessive indentation when the template file is saved.

I know VScode uses beautify but I can't think what would cause this to create 4 indents per line.

{% for rule in rules -%}
				{%- if rule.props -%}
								.{{rule.abbr}}
								{
								{%- for prop in rule.props %}
												{{prop.name | kebabcase}}:
												{{prop.value}};
								{%- endfor %}
								}
				{%- endif -%}
				{% for modifier in rule.modifiers %}
								{% if modifier.name === 'default' %}
												.{{rule.abbr}}
												{
								{%- else -%}
												.{{rule.abbr}}-{{modifier.name}}
												{
								{%- endif -%}
								{%- for prop in modifier.props %}
												{{prop.name | kebabcase}}:
												{{prop.value}};
								{%- endfor %}
								}
				{%- endfor -%}
{%- endfor -%}

Extension does not respect YAML front matter

If I'm editing a *.njk file using a static site generator like Eleventy, I have a need to include YAML front matter in the file, like so:

---
layout: main
---

<p>This is a page</p>

When I save, the YAML is compressed and made to be invalid, like so:

--- layout: main ---

<p>This is a page</p>

This is not ideal. Can we disable this behavior, or at least put it behind a checkbox?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.