{"id":15064936,"url":"https://github.com/remcohaszing/monaco-tailwindcss","last_synced_at":"2025-09-27T15:31:08.833Z","repository":{"id":38026706,"uuid":"476782525","full_name":"remcohaszing/monaco-tailwindcss","owner":"remcohaszing","description":"Tailwindcss intellisense support in Monaco editor","archived":false,"fork":false,"pushed_at":"2023-11-14T11:03:13.000Z","size":525,"stargazers_count":71,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-02T05:14:23.146Z","etag":null,"topics":["monaco","monaco-editor","tailwind","tailwind-css","tailwindcss"],"latest_commit_sha":null,"homepage":"https://monaco-tailwindcss.js.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remcohaszing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-04-01T15:52:28.000Z","updated_at":"2024-06-21T05:47:42.712Z","dependencies_parsed_at":"2023-11-14T11:52:09.400Z","dependency_job_id":null,"html_url":"https://github.com/remcohaszing/monaco-tailwindcss","commit_stats":{"total_commits":122,"total_committers":2,"mean_commits":61.0,"dds":"0.23770491803278693","last_synced_commit":"95ab6f593c5b2b95fb0de02248aa9919635e7bbd"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remcohaszing%2Fmonaco-tailwindcss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remcohaszing%2Fmonaco-tailwindcss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remcohaszing%2Fmonaco-tailwindcss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remcohaszing%2Fmonaco-tailwindcss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remcohaszing","download_url":"https://codeload.github.com/remcohaszing/monaco-tailwindcss/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234338057,"owners_count":18816449,"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":["monaco","monaco-editor","tailwind","tailwind-css","tailwindcss"],"created_at":"2024-09-25T00:28:10.812Z","updated_at":"2025-09-27T15:31:08.821Z","avatar_url":"https://github.com/remcohaszing.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monaco Tailwindcss\n\n[![ci workflow](https://github.com/remcohaszing/monaco-tailwindcss/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/monaco-tailwindcss/actions/workflows/ci.yaml)\n[![npm version](https://img.shields.io/npm/v/monaco-tailwindcss)](https://www.npmjs.com/package/monaco-tailwindcss)\n[![prettier code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)\n[![demo](https://img.shields.io/badge/demo-monaco--tailwindcss.js.org-61ffcf.svg)](https://monaco-tailwindcss.js.org)\n[![netlify Status](https://api.netlify.com/api/v1/badges/d56b5f9b-3adc-4c22-a355-761e72c774ab/deploy-status)](https://app.netlify.com/sites/monaco-tailwindcss/deploys)\n\n[Tailwindcss](https://tailwindcss.com) integration for\n[Monaco editor](https://microsoft.github.io/monaco-editor).\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](#api)\n  - [`monaco-tailwindcss`](#monaco-tailwindcss-1)\n  - [`monaco-tailwindcss/tailwindcss.worker`](#monaco-tailwindcsstailwindcssworker)\n- [Related projects](#related-projects)\n- [License](#license)\n\n## Installation\n\n```sh\nnpm install monaco-tailwindcss\n```\n\n## Usage\n\nImport `monaco-tailwindcss` and configure it before an editor instance is created.\n\n```typescript\nimport * as monaco from 'monaco-editor'\nimport { configureMonacoTailwindcss, tailwindcssData } from 'monaco-tailwindcss'\n\nmonaco.languages.css.cssDefaults.setOptions({\n  data: {\n    dataProviders: {\n      tailwindcssData\n    }\n  }\n})\n\nconfigureMonacoTailwindcss(monaco)\n\nmonaco.editor.create(document.createElement('editor'), {\n  language: 'html',\n  value: `\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv class=\"w-6 h-6 text-gray-600 bg-[#ff8888] hover:text-sky-600 ring-gray-900/5\"\u003e\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n`\n})\n```\n\nAlso make sure to register the web worker. When using Webpack 5, this looks like the code below.\nOther bundlers may use a different syntax, but the idea is the same. Languages you don’t used can be\nomitted.\n\n```js\nwindow.MonacoEnvironment = {\n  getWorker(moduleId, label) {\n    switch (label) {\n      case 'editorWorkerService':\n        return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url))\n      case 'css':\n      case 'less':\n      case 'scss':\n        return new Worker(new URL('monaco-editor/esm/vs/language/css/css.worker', import.meta.url))\n      case 'handlebars':\n      case 'html':\n      case 'razor':\n        return new Worker(\n          new URL('monaco-editor/esm/vs/language/html/html.worker', import.meta.url)\n        )\n      case 'json':\n        return new Worker(\n          new URL('monaco-editor/esm/vs/language/json/json.worker', import.meta.url)\n        )\n      case 'javascript':\n      case 'typescript':\n        return new Worker(\n          new URL('monaco-editor/esm/vs/language/typescript/ts.worker', import.meta.url)\n        )\n      case 'tailwindcss':\n        return new Worker(new URL('monaco-tailwindcss/tailwindcss.worker', import.meta.url))\n      default:\n        throw new Error(`Unknown label ${label}`)\n    }\n  }\n}\n```\n\n## API\n\nThis package exposes two exports. One to setup the main logic, another to customize the Tailwind\nconfiguration in the worker.\n\n### `monaco-tailwindcss`\n\n#### `configureMonacoTailwindcss(monaco, options?)`\n\nConfigure `monaco-tailwindcss`.\n\n**Arguments**:\n\n- `monaco`: The `monaco-editor` module. (`object`)\n- `options`: An object with the following properties:\n  - `languageSelector`: The language ID or IDs to which to apply `monaco-unified`. (`string` |\n    `string[]`, optional, default: `['css', 'javascript', 'html', 'mdx', 'typescript']`)\n  - `tailwindConfig`: The tailwind configuration to use. This may be either the Tailwind\n    configuration object, or a string that gets processed in the worker. (`object` | `string`,\n    optional)\n\n**Returns**: A disposable with the following additional properties:\n\n- `setTailwindConfig(tailwindConfig)`: Update the current Tailwind configuration.\n- `generateStylesFromContent(css, content)`: Generate a CSS string based on the current Tailwind\n  configuration.\n\n#### `tailwindcssData`\n\nThis data can be used with the default Monaco CSS support to support tailwind directives. It will\nprovider hover information from the Tailwindcss documentation, including a link.\n\n### `monaco-tailwindcss/tailwindcss.worker`\n\n#### `initialize(options)`\n\nSetup the Tailwindcss worker using a customized configuration.\n\n**Arguments**:\n\n- `options`: An object with the following properties:\n  - `prepareTailwindConfig(tailwindConfig)` A functions which accepts the Tailwind configuration\n    passed from the main thread, and returns a valid Tailwind configuration.\n\n## Related projects\n\n- [monaco-unified](https://monaco-unified.js.org)\n- [monaco-yaml](https://monaco-yaml.js.org)\n\n## License\n\n[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremcohaszing%2Fmonaco-tailwindcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremcohaszing%2Fmonaco-tailwindcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremcohaszing%2Fmonaco-tailwindcss/lists"}