{"id":18435409,"url":"https://github.com/napsy/go-css","last_synced_at":"2025-04-07T19:32:17.138Z","repository":{"id":57488476,"uuid":"98342499","full_name":"napsy/go-css","owner":"napsy","description":"A very simple CSS parser, written in Go","archived":false,"fork":false,"pushed_at":"2023-06-11T14:29:00.000Z","size":28,"stargazers_count":79,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T00:06:48.708Z","etag":null,"topics":["css","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/napsy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-25T19:28:39.000Z","updated_at":"2025-02-14T07:09:23.000Z","dependencies_parsed_at":"2024-06-18T17:05:15.872Z","dependency_job_id":"5761ace9-d0f0-45a5-a9f1-b212cc6c1faf","html_url":"https://github.com/napsy/go-css","commit_stats":null,"previous_names":["napsy/go-css-parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napsy%2Fgo-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napsy%2Fgo-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napsy%2Fgo-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napsy%2Fgo-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/napsy","download_url":"https://codeload.github.com/napsy/go-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247716424,"owners_count":20984238,"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","golang"],"created_at":"2024-11-06T06:08:08.298Z","updated_at":"2025-04-07T19:32:16.812Z","avatar_url":"https://github.com/napsy.png","language":"Go","readme":"# go-css\n\n[![Build Status](https://travis-ci.org/napsy/go-css.svg?branch=master)](https://travis-ci.org/napsy/go-css)\n[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/vendor/package/blob/master/LICENSE.md)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/napsy/go-css)\n\n\n\nThis parser understands simple CSS and comes with a basic CSS syntax checker.\n\n\n```\ngo get github.com/napsy/go-css\n```\n\nExample usage:\n\n```go\n\nimport \"github.com/napsy/go-css\"\n\nex1 := `rule {\n\tstyle1: value1;\n\tstyle2: value2;\n}`\n\nstylesheet, err := css.Unmarshal([]byte(ex1))\nif err != nil {\n\tpanic(err)\n}\n\nfmt.Printf(\"Defined rules:\\n\")\n\nfor k, _ := range stylesheet {\n\tfmt.Printf(\"- rule %q\\n\", k)\n}\n```\n\nYou can get a CSS verifiable property by calling ``CSSStyle``:\n\n```go\nstyle, err := css.CSSStyle(\"background-color\", styleSheet[\"body\"])\nif err != nil {\n\tfmt.Printf(\"Error checking body background color: %v\\n\", err)\n} else {\n\tfmt.Printf(\"Body background color is %v\", style)\n}\n```\n\nMost of the CSS properties are currently not implemented, but you can always write your own handler by writing a ``StyleHandler`` function and adding it to the ``StylesTable`` map.\n","funding_links":[],"categories":["CSS预处理器","CSS Preprocessors"],"sub_categories":["标准CLI","Standard CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnapsy%2Fgo-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnapsy%2Fgo-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnapsy%2Fgo-css/lists"}