{"id":21654622,"url":"https://github.com/localvoid/jstyle","last_synced_at":"2026-05-19T00:07:52.509Z","repository":{"id":36566164,"uuid":"40872077","full_name":"localvoid/jstyle","owner":"localvoid","description":"[UNMAINTAINED] javascript to css compiler","archived":false,"fork":false,"pushed_at":"2017-02-13T12:54:41.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T22:44:20.910Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localvoid.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":"2015-08-17T07:02:19.000Z","updated_at":"2018-05-17T13:42:44.000Z","dependencies_parsed_at":"2022-07-11T10:03:54.712Z","dependency_job_id":null,"html_url":"https://github.com/localvoid/jstyle","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/localvoid%2Fjstyle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fjstyle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fjstyle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fjstyle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localvoid","download_url":"https://codeload.github.com/localvoid/jstyle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554121,"owners_count":20471173,"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":[],"created_at":"2024-11-25T08:28:27.669Z","updated_at":"2026-05-19T00:07:51.900Z","avatar_url":"https://github.com/localvoid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jstyle\n\njstyle is a javascript to css compiler.\n\n## Usage Example\n\nInstall jstyle CLI:\n\n```sh\n$ npm install -g jstyle-cli\n```\n\nInstal jstyle into your project:\n\n```sh\n$ npm install --save-dev jstyle\n```\n\nCreate file `jstyle.conf.js`:\n\n```js\nconst jstyle = require(\"jstyle\");\nconst select = jstyle.select;\nconst chunk = jstyle.chunk;\n\nconst Base = new jstyle.Module()\n  .rules((c, p) =\u003e [\n    select(c.placeholders(\"buttons\"), [\n      p.margin(c.get(\"button-margin\", 0)),\n    ]),\n  ]);\n\nconst Main = new jstyle.Module()\n  .require(Base),\n  .init((c) =\u003e {\n    c.placeholders(\"buttons\").add(\".MyButton\");\n  })\n  .rules((c, p) =\u003e [\n    select(\".Main\", [\n      p.top(\"20px\")\n    ]),\n  ]);\n\nmodule.exports = {\n  chunks: [\n    chunk(\"main.css\", Main),\n  ],\n  env: () =\u003e {\n    const env = new Map();\n    env.set(\"button-margin\", 10);\n    return env;\n  },\n};\n```\n\nLaunch `jstyle`:\n\n```sh\n$ jstyle -c jstyle.conf.js -o build\n```\n\n## API\n\n### Context\n\n#### Get Variable\n\n`context.get\u003cT\u003e(name: string | Symbol, defaultValue?: T): T`\n\nReturns variable initialized in config environment, or default value if environment doesn't contain it.\n\n#### Get Placeholder\n\n`context.placeholder(name: string): Placeholder`\n\nReturns a placeholder associated with the name parameter.\n\n### Module\n\n#### Add Depencencies\n\n`require(modules: Module | Module[]): Module`\n\nAdd module dependencies.\n\n#### Init\n\n`init(handler: (context: Context, prop: PropertyFactory) =\u003e void)`\n\nAssign an init handler.\n\n#### Rules\n\n`rules(handler: (context: Context, prop: PropertyFactory) =\u003e Rule[])`\n\nAssign a function that should return rules for the module.\n\n### Config\n\n```ts\ninterface ConfigModule {\n  chunks: {fileName: string, modules: Module | Module[]}[];\n  baseChunkFileName: string = \"base.css\";\n  env: Map\u003cstring | Symbol, any\u003e | ((defs: { [key: string]: string }) =\u003e Map\u003cstring | Symbol, any\u003e) = {};\n}\n\ntype Config = ConfigModule | ((defs: {[key: string]: string}) =\u003e ConfigModule);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalvoid%2Fjstyle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalvoid%2Fjstyle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalvoid%2Fjstyle/lists"}