{"id":18316964,"url":"https://github.com/noticeable-app/sass-render","last_synced_at":"2025-04-05T21:32:12.412Z","repository":{"id":37950610,"uuid":"277290884","full_name":"noticeable-app/sass-render","owner":"noticeable-app","description":"Render SASS into importable TypeScript files for Web Components.","archived":false,"fork":false,"pushed_at":"2025-01-20T21:01:55.000Z","size":495,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T12:05:28.909Z","etag":null,"topics":["cli","lit-element","lit-html","render","sass","template","watch","web","webcomponents"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noticeable-app.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":"2020-07-05T11:43:33.000Z","updated_at":"2024-11-02T17:19:31.000Z","dependencies_parsed_at":"2023-01-21T12:17:43.959Z","dependency_job_id":null,"html_url":"https://github.com/noticeable-app/sass-render","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noticeable-app%2Fsass-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noticeable-app%2Fsass-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noticeable-app%2Fsass-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noticeable-app%2Fsass-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noticeable-app","download_url":"https://codeload.github.com/noticeable-app/sass-render/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406029,"owners_count":20933803,"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":["cli","lit-element","lit-html","render","sass","template","watch","web","webcomponents"],"created_at":"2024-11-05T18:04:27.864Z","updated_at":"2025-04-05T21:32:12.073Z","avatar_url":"https://github.com/noticeable-app.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SASS Render\n\nThis project makes your SASS modular, and importable by any Web Component libraries you want to use.\n\nBy default, this utility compiles SASS files to TypeScript style templates using \nthe [lit](https://lit.dev) `css` tag function.\nAlthough this is quite opinionated, you can easily change the output template and the generated file extension.\n\n## Installation\n\nYou can install `sass-render` as a dev dependency in your current project:\n\n```\nnpm install @noticeable/sass-render --save-dev\n```\n\n```\nyarn add @noticeable/sass-render --dev\n```\n\nor as a global package to have the command `sass-render` available everywhere:\n\n```\nnpm install --global @noticeable/sass-render\n```\n\n```\nyarn global add @noticeable/sass-render\n```\n\n\n## Usage \u0026 options\n\nFor a list of complete options, run `sass-render --help`.\n\n### Simple usage\n\nRendering a `./src/components/button-css.ts` file:\n\n```\nsass-render ./src/components/button.scss\n```\n\n### Compile directory\n\nRendering all scss files in a directory, recursively:\n\n```\nsass-render ./src/**/*.scss\n```\n\n### Compile multiple files or directories\n\nRendering multiple scss files and directories, recursively:\n\n```\nsass-render ./src/**/*.scss ./lib/component.scss\n```\n\n### Watching\n\nUse `-w` to watch for changes:\n\n```\nsass-render ./src/**/*.scss -w\n```\n\nFiles will be outputted as `[name]-css.ts`.\n\n### Custom template\n\nUse `-t` to specify the file you'd like to use as a template. `sass-render` will replace `\u003c% content %\u003e` in the file with the generated output:\n\n```\nsass-render ./src/components/button-css.js -t css-template.js\n```\n\n### Expanded CSS\n\nUse `-e` to enable expanded rendering of output CSS. Render SASS outputs CSS as 'compressed' by default, which may cause parsing errors for some projects.\n\n```\nsass-render ./src/components/button-css.js -t -e css-template.js\n```\n\n### Custom suffix\n\nFiles will be outputted as `[name]-css.ts`. If file is `button.scss`, outputted file will be `button-css.ts`. This can be changed with the `--suffix` option.\n\nIf you use a `-` (dash) in your suffix name, eg: `--suffix '-css.js'`, then quotation marks are needed around the suffix (to tell bash it's not another flag).\n\n### Import custom libraries\n\nBy default, sass-render will include the `node_modules` relative to the current directory. Passing the `-i` allows you to include custom directories. You can include multiple directories by separating them with a comma:\n\n```\nsass-render ./src/**/*.scss -i '../sass-lib/'\nsass-render ./src/**/*.scss -i '../sass-lib/, ../another-lib'\n```\n\n### Importing\n\nOnce your SASS files are converted into TypeScript or JavaScript files, you can use them inside a library like \n`lit`. Here is a TypeScript example:\n\n```typescript\nimport {CSSResult, LitElement, TemplateResult, html} from 'lit';\nimport {customElement} from 'lit/decorators.js';\nimport {styles} from './my-button-css.js';\n\n@customElement('my-button')\nexport class MyButton extends LitElement {\n\n    static get styles(): CSSResult {\n        return styles;\n    }\n\n    protected render(): TemplateResult {\n        return html`\u003cbutton\u003e\u003cslot\u003eSubmit\u003c/slot\u003e\u003c/button\u003e`;\n    }\n\n}\n```\n\n## Credits\n\nThis project is inspired by [Google's Material Web Component Sass Render](https://github.com/material-components/material-components-web-components/tree/master/scripts/sass-render).\nIt has been expanded to make the code reusable for other projects and to support recursive directory parsing.\n\nThe original code is a fork of https://github.com/tristanMatthias/wc-sass-render/tree/dc4a15718a7e23532807f45bb09e20edfd10cedd.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoticeable-app%2Fsass-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoticeable-app%2Fsass-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoticeable-app%2Fsass-render/lists"}