{"id":21405360,"url":"https://github.com/karimsa/swirl","last_synced_at":"2026-01-02T09:57:41.572Z","repository":{"id":35249993,"uuid":"39509722","full_name":"karimsa/swirl","owner":"karimsa","description":"CSS-based styling brought into JavaScript.","archived":false,"fork":false,"pushed_at":"2015-07-28T07:09:14.000Z","size":184,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T21:03:58.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karimsa.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-07-22T14:07:41.000Z","updated_at":"2016-07-22T15:06:09.000Z","dependencies_parsed_at":"2022-09-16T20:00:25.246Z","dependency_job_id":null,"html_url":"https://github.com/karimsa/swirl","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/karimsa%2Fswirl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fswirl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fswirl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Fswirl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karimsa","download_url":"https://codeload.github.com/karimsa/swirl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902293,"owners_count":20366259,"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-22T16:24:46.113Z","updated_at":"2026-01-02T09:57:41.546Z","avatar_url":"https://github.com/karimsa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swirl\n\nCSS-based styling brought to JavaScript.\n\n*Please be advised that the API is not frozen. It is under constant development and may drastically change at any time.*\n*If you would like to follow up on those things, please visit the wiki or issues section. This is where potential API changes will be proposed and discussed.*\n\n## Installation\n\nDownload the compiled minified file [swirl.min.js](https://raw.githubusercontent.com/karimsa/swirl/master/swirl.min.js) (and if you'd like to be able to report issues, also download [swirl.min.js.map](https://raw.githubusercontent.com/karimsa/swirl/master/swirl.min.js.map)).\n\nPlace the file(s) somewhere in your project folder, and import the minified source like you would import any script:\n\n```html\n\u003cscript src=\"js/swirl.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nThere's a few different ways to use Swirl, depending on your project. Most simply, you can use the global `Rule` class:\n\n**Simplest usage:**\n\n```javascript\n// create a new rule\nvar rule = new Rule();\n\n// create a new sheet\nvar sheet = new Style();\n\n// attach your rule to your sheet\nsheet.attach(rule);\n\n// set the properties for your rule\nrule.color('#fff')\n\t.background('#000');\n\t\n// and then apply it to whatever selectors you\n// want to use this rule on\nrule.apply('.my-class')\n\t.apply('#my-element, mytag[myattr=\"myval\"]');\n```\n\n### Creating custom classes:\n\nCreating custom classes helps you export your styles as a module for others to use. This helps create extensible UI/UX frameworks and libraries.\n\n```javascript\n// this class can now be exported as a module\nclass MyCustomClass extends Rule {\n\tconstructor (color) {\n\t\tsuper();\n\t\t\n\t\t// set up your initial styles\n\t\tthis.theme(color);\n\t}\n\t\n\t// create whatever additional methods you wish to use\n\ttheme ( color ) {\n\t\tthis.color( color )\n\t\t\t.background( invert ( color ) );\n\t}\n}\n\n// create an instance of the class\nvar myRule = new MyCustomClass('#fff');\nvar mySheet = new Style();\n\n// attach your rule to the sheet\nmySheet.attach(myRule);\n```\n\n## License\n\nGPL-3.0, see [LICENSE](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Fswirl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarimsa%2Fswirl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Fswirl/lists"}