{"id":21286464,"url":"https://github.com/tsega/drupal-8-javascript-snippets-vs-code","last_synced_at":"2026-05-19T06:03:14.770Z","repository":{"id":76853468,"uuid":"131891058","full_name":"tsega/drupal-8-javascript-snippets-vs-code","owner":"tsega","description":"Useful Javascript snippets to use with Drupal 8.","archived":false,"fork":false,"pushed_at":"2024-03-07T09:49:35.000Z","size":370,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T15:16:42.864Z","etag":null,"topics":["drupal-8","javascript","snippets","visual-studio-code"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsega.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-02T18:30:49.000Z","updated_at":"2024-03-07T09:49:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"a30a852c-6e75-48ff-970e-8a2cf6c19474","html_url":"https://github.com/tsega/drupal-8-javascript-snippets-vs-code","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tsega/drupal-8-javascript-snippets-vs-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsega%2Fdrupal-8-javascript-snippets-vs-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsega%2Fdrupal-8-javascript-snippets-vs-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsega%2Fdrupal-8-javascript-snippets-vs-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsega%2Fdrupal-8-javascript-snippets-vs-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsega","download_url":"https://codeload.github.com/tsega/drupal-8-javascript-snippets-vs-code/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsega%2Fdrupal-8-javascript-snippets-vs-code/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264552311,"owners_count":23626691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal-8","javascript","snippets","visual-studio-code"],"created_at":"2024-11-21T11:29:32.519Z","updated_at":"2026-05-19T06:03:09.732Z","avatar_url":"https://github.com/tsega.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal 8 JavaScript snippets for Visual Studio Code\n\nThis extension adds 2 useful JavaScript snippets that can be used with Drupal 8. These snippets were extracted from the [JavaScript API overview](https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview) documentation.\n\n## Installation\n\nTo install this extension use the following steps:\n\n1. In VS Code, open the **Command Palette** using the shortcut key combination `ctrl-shift-p` (Windows, Linux) or `cmd-shift-p` (OSX)\n1. Then in the Command Palette box, type in `Install Extensions` and select that form the list.\n1. This will open up the **Extension Manager**. In the search box type in `Drupal 8 JavaScript Snippets`.\n1. Click the **Install** button, after that finishes make sure to reload VS Code as well.\n\n## Usage\n\nOnce installed, to use these snippets you can use the following two methods, the first Method is geared towards people who are new to the snippets available while the second method is suitable for people who know the available snippets and are looking to increase their speed.\n\n### Method 1\n1. Open the **Command Palette**, `ctrl-shift-p` (Windows, Linux) or `cmd-shift-p` (OSX)\n1. In the command box type in `Insert Snippet`; this will list all the available snippets.\n1. Select the snippet you want to use from the provided list.\n\n### Method 2\n1. In the code editor window, type in the **Prefix** of the snippet you want to insert. This will show an intellisense window as you type.\n1. Insert the snippet you want by simply pressing the `tab` key.\n\n## Features\n\nHere you will find all the code snippets that are available in this extension. Please note that each title starts with the **Prefix** of the code snippet to insert; useful to memorize them if you plan to use [Method 2](#Method-2) above.\n\n### jqw - jQuery Wrapper\n\nThis wrapper makes the $ jQuery short code avialable for code inside it.\n\nExample:\n```js\n(function ($, Drupal) {\n    $(\".invisible\").hide();\n}(jQuery, Drupal));\n```\n\n![jQuery Wrapper](images/jqw.gif \"jQuery Wrapper Drupal 8 JavaScript Snippet\")\n\n### bhv - Drupal 8 Behavior\n\nThis inserts a Drupal 8 JS behavior.\n\nExample:\n```js\nDrupal.behaviors.myBehavior = {\n    attach: function (context, settings) {\n        console.log('My Behavior');\n    }\n};\n```\n\n![Drupal 8 Behavior](images/bhv.gif \"Behavior Drupal 8 JavaScript Snippet\")\n\n### Requirements\n\nThese snippets are only made available in files with a `.js` extension.\n\n## Release Notes\n\n### 0.0.2\n\nMake name consistent with related twig module\n\n### 0.0.1\n\nInitial release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsega%2Fdrupal-8-javascript-snippets-vs-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsega%2Fdrupal-8-javascript-snippets-vs-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsega%2Fdrupal-8-javascript-snippets-vs-code/lists"}