Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/endlesstrax/python-template-snippets
A VS Code snippet extension for both the Jinja2 and Django template engines.
https://github.com/endlesstrax/python-template-snippets
django-snippets flask-snippets hactoberfest python-template-snippets vscode vscode-extension
Last synced: 3 months ago
JSON representation
A VS Code snippet extension for both the Jinja2 and Django template engines.
- Host: GitHub
- URL: https://github.com/endlesstrax/python-template-snippets
- Owner: EndlessTrax
- License: mit
- Created: 2018-10-20T16:45:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-26T20:11:38.000Z (about 1 year ago)
- Last Synced: 2024-08-07T23:15:43.319Z (6 months ago)
- Topics: django-snippets, flask-snippets, hactoberfest, python-template-snippets, vscode, vscode-extension
- Homepage: https://marketplace.visualstudio.com/items?itemName=RickyWhite.python-template-snippets
- Size: 26.4 KB
- Stars: 13
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Python Template Snippets
This VS Code snippet extension includes snippets for both the Jinja2 and Django template engines.
Quickly add snippets to HTML template files in your project.
If there is a snippet that is not included in this extension, please open an issue on the [repo here](https://github.com/EndlessTrax/python-template-snippets).
## Setup
Just hit install!
If installing this extension directly from the repo, copy it into your local `/.vscode/extensions` folder and restart VS Code.
Works best with `editor.tabCompletion` enabled (`on`) in your VS Code `Settings`.
## Usage
Simply type `pt` to start using any of the snippets. The full documentation is below.
This extension works best with `editor.tabCompletion` enabled (`on`) in your VS Code `Settings`.
## Changelog
The full changelog can be found [here](CHANGELOG.md).
## Documentation
See the tables below for general, jinja, django snippets. The `*` denotes where the cursor will start so you can start typing your variables etc. straight the way without wasting key strokes! A `*2` denotes the second position upon hitting the `tab` key again.
### General Snippets
Prefix | Output
-------|-------
ptnew | Creates a simple base template for any Jinja/Django HTML file
ptvar | {{ `*` }}
ptfilt | {{ `* | *2` }}
ptcode | {% `*` %}
ptblock | {% block `*` %} {% endblock `*` %}
ptext | {% extends ' `*` ' %}
ptsup | {{ `super()` }}
ptfor | Adds a `for` loop block
ptif | Adds an `if` statement block
ptifel | Adds an `if/else` statement block
ptelif | Adds an `if/elif/else` statement block
ptwith | Adds a `with` statement block### Jinja Specific Snippets
Prefix | Output
-------|-------
ptj-url | {{ url_for('static', filename=' `*` ') }}
ptj-mac | {% macro `*` %} {% endmacro %}
ptj-com | {# `*` #}
ptj-set | {% set `*` = `*2` %}### Django Specific Snippets
Prefix | Output
-------|-------
ptd-url | {% url ' `*` ' `*2` %}
ptd-load | {% load `*` %}
ptd-stat | {% static ' `*` ' %}
ptd-inc | {% include ' `*` ' %}## Release Notes
See the [Changelog](https://github.com/EndlessTrax/python-template-snippets/blob/master/CHANGELOG.md)
---
This snippet was authored by [Ricky White](https://twitter.com/endlesstrax), and is an open-source extension. Please help to improve this by [submitting issues here](https://github.com/EndlessTrax/python-template-snippets/issues).
If you'd like to sponsor the developwment of this extension, please consider [sponsoring me on GitHub](https://github.com/sponsors/EndlessTrax)
**Happy Coding!**