{"id":21352057,"url":"https://github.com/static-dev/spike-page-id","last_synced_at":"2025-03-16T04:41:59.900Z","repository":{"id":57367490,"uuid":"67077095","full_name":"static-dev/spike-page-id","owner":"static-dev","description":"generates a css-friendly page identifier for easy css scoping","archived":false,"fork":false,"pushed_at":"2019-02-05T12:42:56.000Z","size":538,"stargazers_count":0,"open_issues_count":6,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-25T03:18:19.192Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/static-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-31T22:09:54.000Z","updated_at":"2016-08-31T22:12:25.000Z","dependencies_parsed_at":"2022-08-23T20:10:22.942Z","dependency_job_id":null,"html_url":"https://github.com/static-dev/spike-page-id","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-page-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-page-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-page-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-page-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/static-dev","download_url":"https://codeload.github.com/static-dev/spike-page-id/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826785,"owners_count":20354220,"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-22T03:12:25.781Z","updated_at":"2025-03-16T04:41:59.877Z","avatar_url":"https://github.com/static-dev.png","language":"JavaScript","readme":"# Spike Page ID\n\n[![npm](https://img.shields.io/npm/v/spike-page-id.svg?style=flat-square)](https://npmjs.com/package/spike-page-id)\n[![tests](https://img.shields.io/travis/static-dev/spike-page-id.svg?style=flat-square)](https://travis-ci.org/static-dev/spike-page-id?branch=master)\n[![dependencies](https://img.shields.io/david/static-dev/spike-page-id.svg?style=flat-square)](https://david-dm.org/static-dev/spike-page-id)\n[![coverage](https://img.shields.io/coveralls/static-dev/spike-page-id.svg?style=flat-square)](https://coveralls.io/r/static-dev/spike-page-id?branch=master)\n\nGenerates a css-friendly page identifier from a webpack loader context\n\n\u003e **Note:** This project is in early development, and versioning is a little different. [Read this](http://markup.im/#q4_cRZ1Q) for more details.\n\n\n### Installation\n\n`npm install spike-page-id -S`\n\n\u003e **Note:** This project is compatible with node v6+ only\n\n### Usage\n\nIn your spike config:\n\n```js\nconst htmlStandards = require('reshape-standard')\nconst pageId = require('spike-page-id')\n\nmodule.exports = {\n  // other config…\n  reshape: (ctx) =\u003e {\n    return htmlStandards({\n      locals: { pageId: pageId(ctx) }\n    })\n  }\n}\n```\n\nNow in your html, let's say it's called `index.sgr`:\n\n```\nhtml\n  head\n    title My page\n  body(id='{{ pageId }}')\n    p hello world\n```\n\nThis will render something like:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eMy page\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody id='index'\u003e\n    \u003cp\u003ehello world\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nIf you are working with a page that's nested inside other folders, it will include all folders relative to the project root, separated by a hyphen. So for example:\n\n- `views/index.sgr` \u003e `index`\n- `views/posts/welcome.sgr` \u003e `posts-welcome`\n\n…and that's about it!\n\n### License \u0026 Contributing\n\n- Details on the license [can be found here](LICENSE.md)\n- Details on running tests and contributing [can be found here](contributing.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatic-dev%2Fspike-page-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatic-dev%2Fspike-page-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatic-dev%2Fspike-page-id/lists"}