{"id":19125119,"url":"https://github.com/shoonia/parcel-plugin-css-to-string","last_synced_at":"2026-03-04T14:32:18.923Z","repository":{"id":35192347,"uuid":"215994373","full_name":"shoonia/parcel-plugin-css-to-string","owner":"shoonia","description":"Importing CSS files as a string to JavaScript (Support Parcel v1)","archived":false,"fork":false,"pushed_at":"2024-02-21T13:16:30.000Z","size":2202,"stargazers_count":7,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-20T20:20:35.568Z","etag":null,"topics":["css","parcel-bundler","parcel-plugin","webcomponents"],"latest_commit_sha":null,"homepage":"","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/shoonia.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}},"created_at":"2019-10-18T09:58:07.000Z","updated_at":"2022-01-22T07:38:32.000Z","dependencies_parsed_at":"2024-02-21T14:29:49.634Z","dependency_job_id":"9736017f-c6a2-4fe1-b740-5c3c3e4f9a06","html_url":"https://github.com/shoonia/parcel-plugin-css-to-string","commit_stats":{"total_commits":68,"total_committers":4,"mean_commits":17.0,"dds":0.5735294117647058,"last_synced_commit":"7529efb301d4da9690d17abfbc7e107864ae8443"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shoonia/parcel-plugin-css-to-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoonia%2Fparcel-plugin-css-to-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoonia%2Fparcel-plugin-css-to-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoonia%2Fparcel-plugin-css-to-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoonia%2Fparcel-plugin-css-to-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shoonia","download_url":"https://codeload.github.com/shoonia/parcel-plugin-css-to-string/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoonia%2Fparcel-plugin-css-to-string/sbom","scorecard":{"id":820589,"data":{"date":"2025-08-11","repo":{"name":"github.com/shoonia/parcel-plugin-css-to-string","commit":"75f0046699603125b4a855e7e3722e77b7c7d014"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/shoonia/parcel-plugin-css-to-string/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/shoonia/parcel-plugin-css-to-string/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/shoonia/parcel-plugin-css-to-string/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shoonia/parcel-plugin-css-to-string/ci.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"35 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T15:25:18.174Z","repository_id":35192347,"created_at":"2025-08-23T15:25:18.174Z","updated_at":"2025-08-23T15:25:18.174Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30083761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T13:22:36.021Z","status":"ssl_error","status_checked_at":"2026-03-04T13:20:45.750Z","response_time":59,"last_error":"SSL_read: 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","parcel-bundler","parcel-plugin","webcomponents"],"created_at":"2024-11-09T05:34:37.792Z","updated_at":"2026-03-04T14:32:18.893Z","avatar_url":"https://github.com/shoonia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# parcel-plugin-css-to-string\n\n![support parcel v1](https://img.shields.io/badge/Parcel-v1-3638f4)\n[![test status](https://github.com/shoonia/parcel-plugin-css-to-string/workflows/test/badge.svg)](https://github.com/shoonia/parcel-plugin-css-to-string/actions)\n[![npm version](https://img.shields.io/npm/v/parcel-plugin-css-to-string.svg)](https://www.npmjs.com/package/parcel-plugin-css-to-string)\n\nImporting CSS files as a string to JavaScript.\n\nTransform plugin for **Parcel v1**\n\n\u003e Support **Parcel v2**: [parcel-transformer-css-to-string](https://github.com/shoonia/parcel-transformer-css-to-string)\n\n**styles.css**\n```css\n.text {\n  color: #162D3D;\n}\n```\n**index.js**\n```js\nimport styles from \"./styles.css\";\n\nconsole.log(styles); // \".text{color:#162D3D}\"\n```\n\n## Install\n```bash\nnpm i --save-dev parcel-plugin-css-to-string\n# or\nyarn add -D parcel-plugin-css-to-string\n```\n\n## How to use\nI'm recommending to use the custom extension to your styles which will be imported as a string. It will help to escape conflicts with `.css` files for global styles or css-modules. The default asset type `css`.\n\nYou can add the list of your custom extensions to `.parcelrc` config. [Syntax highlight custom extension](#developer-tools)\n\nFor example: `styles.cssx`.\n\n**.parcelrc**\n```json\n{\n  \"parcel-plugin-css-to-string\": {\n    \"assetType\": [\"cssx\"]\n  }\n}\n```\n\n## Example\nWeb component styles via the Shadow DOM\n```bash\nmy-app\n├── src\n│   ├── styles.cssx\n│   └── index.js\n└── .parcelrc\n```\n\n**src/styles.cssx**\n```css\n.title {\n  text-align: center;\n}\n```\n**src/index.js**\n```js\nimport styles from \"./styles.cssx\";\n\nconst root = document.createElement(\"div\");\n\nroot.innerHTML = `\n\u003cstyle\u003e${styles}\u003c/style\u003e\n\u003cdiv\u003e\n  \u003ch1 class=\"title\"\u003eHello!\u003c/h1\u003e\n\u003c/div\u003e\n`;\n\nclass MyWebComponent extends HTMLElement {\n  connectedCallback() {\n    this.attachShadow({ mode: \"open\" }).appendChild(root);\n  }\n}\n\nwindow.customElements.define(\"my-web-component\", MyWebComponent);\n```\n\n## Plugin options\n\nyour `.parcelrc`\n```json\n{\n  \"parcel-plugin-css-to-string\": {\n    \"assetType\": [\"css\"],\n    \"minify\": true,\n    \"enableCSS\": false\n  }\n}\n```\nor `package.json`\n```diff\n{\n  \"name\": \"my_package\",\n  \"description\": \"\",\n  \"version\": \"1.0.0\",\n  \"main\": \"index.js\",\n  \"devDependencies\": {\n    \"parcel-bundler\": \"^1.x\",\n    \"parcel-plugin-css-to-string\": \"^2.x\"\n  },\n+  \"parcel-plugin-css-to-string\": {\n+    \"assetType\": [\"css\"],\n+    \"minify\": true,\n+    \"enableCSS\": false\n+  }\n}\n```\n\n| Name           | Type              | Default   | Description |\n|:--------------:|:-----------------:|:---------:|:-----------:|\n| **assetType**  | `{Array\u003cstring\u003e}` | `[\"css\"]` | List of asset types imported to javascript as a string.\n| **minify**     | `{Boolean}`       | `true`    | on/off minification\n| **enableCSS**  | `{Boolean}`       | `false`   | on/off the generation of CSS files\n\n### Minify config\nYou can configure minify CSS in production build, where custom configuration can be set by creating `cssnano.config.js` file\n\n**cssnano.config.js**\n```js\nmodule.exports = {\n  preset: [\n    \"default\",\n    {\n      calc: false,\n      discardComments: {\n        removeAll: true\n      }\n    }\n  ]\n}\n```\n\n### PostCSS\nYou can configure CSS transforming with PostCSS creating a configuration file using one of these names: `.postcssrc` (JSON), `.postcssrc.js`, or `postcss.config.js`.\n\n\u003e `.postcssrc` config omit `.parcelrc` option `minify`.\n\u003e If you use PostCSS config then you need added `cssnano` plugin to minify production build.\n\n**.postcssrc**\n```js\n{\n  \"plugins\": {\n    \"postcss-import\": {},\n    \"autoprefixer\": {},\n    \"cssnano\": {}\n  }\n}\n```\n\n## Developer tools\nYou can configure how the IDE will parse the files with custom extension.\n\n### VS Code\nAdd to the root folder of your project a new folder `.vscode` with file `settings.json`\n```bash\nmy-app\n├── .vscode\n│   └── settings.json\n├── src\n│   ├── styles.cssx\n│   └── index.js\n└── .parcelrc\n```\n**.vscode/settings.json**\n```json\n{\n  \"files.associations\": {\n    \"*.cssx\": \"css\",\n    \".parcelrc\": \"json\",\n    \".postcssrc\": \"json\"\n  }\n}\n```\n- [VS Code: Language Identifiers](https://code.visualstudio.com/docs/languages/identifiers)\n\n## License\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoonia%2Fparcel-plugin-css-to-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshoonia%2Fparcel-plugin-css-to-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoonia%2Fparcel-plugin-css-to-string/lists"}