{"id":15416278,"url":"https://github.com/herber/vxv","last_synced_at":"2025-04-19T14:33:15.726Z","repository":{"id":28852683,"uuid":"119513224","full_name":"herber/vxv","owner":"herber","description":"👓💄 A tiny library for writing native css code in JavaScript.","archived":false,"fork":false,"pushed_at":"2022-12-07T10:22:12.000Z","size":1270,"stargazers_count":10,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T02:42:57.626Z","etag":null,"topics":["css","css-in-js","server-side-rendering","styles","stylesheets","tiny","vxv"],"latest_commit_sha":null,"homepage":"https://vxv.js.org","language":"JavaScript","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/herber.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-30T09:26:57.000Z","updated_at":"2022-03-06T03:51:41.000Z","dependencies_parsed_at":"2023-01-14T13:45:22.441Z","dependency_job_id":null,"html_url":"https://github.com/herber/vxv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fvxv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fvxv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fvxv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herber%2Fvxv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/herber","download_url":"https://codeload.github.com/herber/vxv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249352357,"owners_count":21255885,"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":["css","css-in-js","server-side-rendering","styles","stylesheets","tiny","vxv"],"created_at":"2024-10-01T17:11:24.452Z","updated_at":"2025-04-19T14:33:15.703Z","avatar_url":"https://github.com/herber.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.imgur.com/R4GAGr8.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/herber/vxv\"\u003e\u003cimg src=\"https://travis-ci.org/herber/vxv.svg?branch=master\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/herber/vxv\"\u003e\u003cimg src=\"https://codecov.io/gh/herber/vxv/branch/master/graph/badge.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/herber/vxv/maintainability\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/133d21f1c0e84bfa9e6b/maintainability\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://npm.im/vxv\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/vxv.svg\" alt=\"vxv\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A tiny library for writing native css code in JavaScript.\u003cbr\u003e\u003cb\u003eVXV\u003c/b\u003e is powered by \u003ca href=\"https://github.com/thysultan/stylis.js\"\u003estylis\u003c/a\u003e, a fast css preprocessor.\n\u003c/p\u003e\n\n## Features\n  - __Tiny__: VXV does not bloat you bundle\n  - Powered by __tagged template literals__\n  - __Namespaced__: VXV automatically namespaces your css\n  - __Modular__: Import css from js files\n  - __Isomorphic__: VXV works in node and in browsers, this is great for server side rendering\n  - __Just CSS__: VXV does not force you to learn anything new, it's just good old css.\n\n## Install\n\n```\n$ npm install vxv\n```\n\n## Usage\n\n__VXV__ supports standard css(with some extras). It returns a simple class name that you can use to access the styles.\n\n```js\nconst vxv = require('vxv');\nconst xou = require('xou');\n\nconst styles = vxv`\nfont-family: sans-serif;\n\n// Nested elements have to be tagged by an \u0026.\n\u0026 h1 {\n  color: red;\n}\n\n\u0026 p {\n  color: blue;\n}\n`;\n\nconst element = xou`\u003cdiv class=\"${ styles }\"\u003e\n  \u003ch1\u003eI am red.\u003c/h1\u003e\n  \u003cp\u003eI am blue.\u003c/p\u003e\n\u003c/div\u003e`;\n\ndocument.body.appendChild(element);\n```\n\n### Dynamic styles\n\nYou can use plain old JavaScript variables for dynamic styles. You could even build mixins using JavaScript functions.\n\n```js\nconst vxv = require('vxv');\nconst xou = require('xou');\n\nconst color = 'blue';\n\nconst styles = vxv`\nfont-family: sans-serif;\n\n\u0026 h1 {\n  color: ${ color };\n}\n`;\n\nconst element = xou`\u003cdiv class=\"${ styles }\"\u003e\n  \u003ch1\u003eI am blue\u003c/h1\u003e\n\u003c/div\u003e`;\n```\n\n### Styling subelements\n\nSubelements have to be suffixed by an `\u0026`.\n\n```js\nconst vxv = require('vxv');\n\nvxv`\n\u0026 p {\n  text-align: center;\n\n  \u0026.red {\n    color: red;\n  }\n}\n`;\n```\n\n### Styling global elements\n\nGlobal elements have to be tagged by the `global` statement.\n\n```js\nconst vxv = require('vxv');\n\nvxv`\n:global(body) {\n  background: red;\n}\n`;\n```\n\n### Serverside rendering\n\nFor serverside rendering you need the [`vxv-server`](https://github.com/herber/vxv/tree/master/packages/vxv-server) module.\n\n__VXV-Server__ processes your styles just like __VXV__ does including hash prefixing. `server()` will return a simple string containing all your styles - you can now save those styles somewhere or send them directly to the user.\n\n```js\nconst vxv = require('vxv');\nconst server = require('vxv-server');\n\nconst mainStyles = vxv`\nh1 { font-size: 2rem }\nh2 { font-size: 1.5rem }\nh3 { font-size: 1.25rem }\nh4 { font-size: 1rem }\nh5 { font-size: .875rem }\nh6 { font-size: .75rem }\n`;\n\nconst otherStyles = vxv`\np, dl, ol, ul, pre, blockquote {\n  margin-top: 1em;\n  margin-bottom: 1em;\n}\n`;\n\nserver();\n// =\u003e All styles even those used in other files -\n// =\u003e prefixed and concatenated into single string,\n// =\u003e that you can use for serverside rendering.\n```\n\n## Monorepo\n\nThis is a monorepo, which means that there are multiple node modules in a single git repository, all the modules are in `packages/`. Monorepos are used by many other oss projects including [babel](http://babeljs.io), [react](http://reactjs.org) and [meteor](meteor.com) - [Learn why](https://github.com/babel/babel/blob/9f90b6f1405f80b432c6f20d18ca6c584cc1e6bb/doc/design/monorepo.md).\n\n#### Packages\n\n- [vxv](https://github.com/herber/vxv/tree/master/packages/vxv)\n- [vxv-server](https://github.com/herber/vxv/tree/master/packages/vxv-server)\n- [vxv-hash](https://github.com/herber/vxv/tree/master/packages/vxv-hash)\n- [vxv-parser](https://github.com/herber/vxv/tree/master/packages/vxv-parser)\n- [vxv-insert](https://github.com/herber/vxv/tree/master/packages/vxv-insert)\n- [vxv-state](https://github.com/herber/vxv/tree/master/packages/vxv-state)\n\n## License\n\nMIT © [Tobias Herber](http://tobihrbr.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherber%2Fvxv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherber%2Fvxv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherber%2Fvxv/lists"}