{"id":40506192,"url":"https://github.com/tomhodgins/jsincss-previous-selector","last_synced_at":"2026-01-20T19:36:16.068Z","repository":{"id":57284484,"uuid":"119199344","full_name":"tomhodgins/jsincss-previous-selector","owner":"tomhodgins","description":"A previous selector plugin for jsincss","archived":false,"fork":false,"pushed_at":"2018-12-24T20:57:14.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-30T18:33:27.188Z","etag":null,"topics":["css","css-selector","js-in-css","jsincss","previous","previous-selector","previous-sibling","selector-resolver","sibling"],"latest_commit_sha":null,"homepage":null,"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/tomhodgins.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-27T20:19:18.000Z","updated_at":"2018-12-24T20:57:16.000Z","dependencies_parsed_at":"2022-09-16T22:40:36.829Z","dependency_job_id":null,"html_url":"https://github.com/tomhodgins/jsincss-previous-selector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomhodgins/jsincss-previous-selector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhodgins%2Fjsincss-previous-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhodgins%2Fjsincss-previous-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhodgins%2Fjsincss-previous-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhodgins%2Fjsincss-previous-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomhodgins","download_url":"https://codeload.github.com/tomhodgins/jsincss-previous-selector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhodgins%2Fjsincss-previous-selector/sbom","scorecard":{"id":892622,"data":{"date":"2025-08-18","repo":{"name":"github.com/tomhodgins/jsincss-previous-selector","commit":"1c177d68763febf6552b9141b6fb0ac1d4893ee3"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T12:26:43.807Z","repository_id":57284484,"created_at":"2025-08-24T12:26:43.807Z","updated_at":"2025-08-24T12:26:43.807Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28610769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-selector","js-in-css","jsincss","previous","previous-selector","previous-sibling","selector-resolver","sibling"],"created_at":"2026-01-20T19:36:15.358Z","updated_at":"2026-01-20T19:36:16.058Z","avatar_url":"https://github.com/tomhodgins.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsincss-previous-selector\n\nA previous selector plugin for [jsincss](https://github.com/tomhodgins/jsincss)\n\n## About\n\nThis plugin is a JavaScript module that works with [JS-in-CSS stylesheets](https://responsive.style/theory/what-is-a-jic-stylesheet.html), to select the element before the element(s) matching a selector.\n\n## Downloading\n\nYou can download jsincss-previous-selector and add it to your codebase manually, or download it with npm:\n\n```bash\nnpm install jsincss-previous-selector\n```\n\nAnother option that works for building or testing, that isn't ideal for production use, is linking to the module directly from a CDN like unpkg:\n\n```html\n\u003cscript type=module\u003e\n  import previous from 'https://unpkg.com/jsincss-previous-selector/index.vanilla.js'\n\u003c/script\u003e\n```\n\n## Importing\n\nThis plugin exists in three different formats:\n\n- CommonJS module: [index.js](index.js)\n- Vanilla JS module: [index.vanilla.js](index.vanilla.js)\n- Browser function: [index.browser.js](index.browser.js)\n\nYou can import this plugin using the native [`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) statement in JavaScript. Here you can assign any name you want to the function you are importing, and you only need to provide a path to the plugin's `index.vanilla.js` file:\n\n```js\nimport previous from './index.vanilla.js'\n```\n\nYou can also use the CommonJS-formatted module located at [index.js](index.js) with `require()` for use with bundlers that don't use vanilla JS modules.\n\nOnce you have imported this plugin into your module, you can use the plugin as `previous()`\n\n## Using JS-in-CSS Stylesheets\n\nThe main goal of this plugin is to allow CSS authors the ability to target the elements directly preceding element(s) that match a CSS selector in the document.\n\nThe plugin has the following format:\n\n```js\nprevious(selector, rule)\n```\n\n- `selector` is a string containing a CSS selector\n- `rule` is a string or template string containing a CSS rule\n\n## Example\n\nThis example will use the `jsincss` plugin to load a JS-in-CSS stylesheet making use of this plugin. To test it in a JavaScript module, import both the `jsincss` package and any helper plugins you want:\n\n```html\n\u003cscript type=module\u003e\n  import jsincss from 'https://unpkg.com/jsincss/index.vanilla.js'\n  import previous from 'https://unpkg.com/jsincss-previous-selector/index.vanilla.js'\n\n  jsincss(() =\u003e `\n\n    ${previous('li:last-of-type', `\n      background: lime;\n    `)}\n\n  `)\n\u003c/script\u003e\n```\n\nIt's also possible to write your stylesheets as a separate JavaScript module like this, where you import any helper plugins at the top of the stylesheet:\n\n```js\nimport previous from 'https://unpkg.com/jsincss-previous-selector/index.vanilla.js'\n\nexport default () =\u003e `\n\n  ${previous('li:last-of-type', `\n    background: lime;\n  `)}\n\n`\n```\n\nAnd then import both the `jsincss` plugin and the stylesheet into your code and run them like this, suppling any `selector` or `events` list the `jsincss` plugin might need to apply the stylesheet only the the element(s) and event(s) you require, depending on what you're doing:\n\n```js\nimport jsincss from 'https://unpkg.com/jsincss/index.vanilla.js'\nimport stylesheet from './path/to/stylesheet.js'\n\njsincss(stylesheet)\n```\n\n## Compatible JS-in-CSS Stylesheet Loaders\n\n- [jsincss](https://github.com/tomhodgins/jsincss)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhodgins%2Fjsincss-previous-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomhodgins%2Fjsincss-previous-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhodgins%2Fjsincss-previous-selector/lists"}