{"id":17345027,"url":"https://github.com/jgranstrom/sass-extract-loader","last_synced_at":"2025-04-13T18:40:34.912Z","repository":{"id":54672425,"uuid":"80288048","full_name":"jgranstrom/sass-extract-loader","owner":"jgranstrom","description":"Webpack loader for https://github.com/jgranstrom/sass-extract","archived":false,"fork":false,"pushed_at":"2023-10-26T16:04:29.000Z","size":34,"stargazers_count":44,"open_issues_count":10,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T09:21:40.402Z","etag":null,"topics":["loader","sass","sass-extract","sass-extract-loader","scss","webpack"],"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/jgranstrom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-01-28T14:13:28.000Z","updated_at":"2023-03-14T11:27:56.000Z","dependencies_parsed_at":"2024-06-18T15:39:22.908Z","dependency_job_id":null,"html_url":"https://github.com/jgranstrom/sass-extract-loader","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"7b93642d2ffa5b79ff9057488832c0a4c7b43c44"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fsass-extract-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fsass-extract-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fsass-extract-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgranstrom%2Fsass-extract-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgranstrom","download_url":"https://codeload.github.com/jgranstrom/sass-extract-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248764199,"owners_count":21158040,"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":["loader","sass","sass-extract","sass-extract-loader","scss","webpack"],"created_at":"2024-10-15T16:28:38.933Z","updated_at":"2025-04-13T18:40:34.885Z","avatar_url":"https://github.com/jgranstrom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sass-extract-loader\n\n[![Build Status](https://travis-ci.org/jgranstrom/sass-extract.svg?branch=master\u0026style=flat)](https://travis-ci.org/jgranstrom/sass-extract-loader)\n[![npm version](https://badge.fury.io/js/sass-extract-loader.svg)](http://badge.fury.io/js/sass-extract-loader)\n[![dependencies Status](https://david-dm.org/jgranstrom/sass-extract-loader/status.svg)](https://david-dm.org/jgranstrom/sass-extract-loader)\n[![devDependencies Status](https://david-dm.org/jgranstrom/sass-extract-loader/dev-status.svg)](https://david-dm.org/jgranstrom/sass-extract-loader?type=dev)\n[![peerDependencies Status](https://david-dm.org/jgranstrom/sass-extract-loader/peer-status.svg)](https://david-dm.org/jgranstrom/sass-extract-loader?type=peer)\n\nWebpack loader for [sass-extract](https://github.com/jgranstrom/sass-extract).\n\nRequire sass files as modules containing the variables defined in those files. Supports `@include` directives for extracting variables across multiple files.\n\nThis does **not** replace the [sass-loader](https://github.com/jtangelder/sass-loader) for requiring sass in order to generate css, but serves as an additional tool in order to use variables defined in sass in your javascript modules.\n\n[![demo.gif](https://s27.postimg.org/w40sdzqjn/demo.gif)](https://postimg.org/image/oba4m0kkf/)\n\n## Install\n\nYou need to install the sass compiler, sass-extract and the loader since they are all [peer dependencies](https://nodejs.org/en/blog/npm/peer-dependencies/).\n\n```\nnpm install --save node-sass sass-extract sass-extract-loader\n```\n\n## Usage\n\n##### Recommended\n\nThe recommended usage is to use the loader explicitly when requiring `.sass` or `.scss` files since you are likely to have separate loader for generating the css for your app from the same sass files.\n\n```\nconst style = require('sass-extract-loader!./style.scss');\n\n/*\nstyle ==\u003e {\n  global: {\n    $variable: \u003cvalue\u003e\n    ..\n  }\n}\n*/\n```\n\n##### Alternative\n\nYou can add the loader in your webpack configuration file as expected.\n\n```\n{\n  module: {\n    loaders: [\n      {\n        test: /\\.scss$/,\n        loader: 'sass-extract-loader'\n      }\n    ]\n  }\n}\n```\n\nNote that this alternative might not be a good choice as you likely want the default behavior of requiring a sass files to be generating css from it. However, you might have a case when you want to use certain files as runtime variables to be handled by the sass-extract-loader by default.\n\n```\n{\n  module: {\n    loaders: [\n      {\n        test: /\\.runtime\\.scss$/,\n        loader: 'sass-extract-loader'\n      }\n    ]\n  }\n}\n```\n\nThe resulting module will be a plain JSON object containing the extracted variables and their values. For detailed documentation on the structure and semantics of the response head over to the documentation for [sass-extract](https://github.com/jgranstrom/sass-extract).\n\n## Options\n\nAll options available for `node-sass` can be passed to the loader with any of the available methods for webpack.\n\nAn example is including a path for resolving imports such as `const styleVariables = require('sass-extract-loader?{\"includePaths\": [\"./foobar\"]}!./style.scss');`.\n\n## Plugins\n\nPlugins can be used by passing plugin module names in the query options to the loader `const styleVariables = require('sass-extract-loader?{\"plugins\": [\"minimal\"]}!./style.scss');`.\n\n## Examples\n\nHead over to the [examples](examples) section to see available examples. Simply clone this repository and follow the simple instructions within each example directory to try them out.\n\n## Requirements\n- `node-sass \u003e= 3.8.0`\n- `node \u003e= 4`\n\n## Contributing\n\n##### Running tests\n\n```bash\nnpm test\n```\n\n##### Commits\n\nIn order to have readable commit messages and the ability to generate a changelog the commit messages should follow a certain structure.\n\nTo make it easier install `npm install -g commitizen` and commit using `git-cz`.\n\nGenerate changelog using `npm install -g conventional-changelog` and `npm run changelog`.\n\n##### Releasing new versions\n\n1. Make changes\n2. Commit those changes\n4. Set new version in package.json\n5. `npm run changelog`\n6. Commit package.json and CHANGELOG.md files\n7. Tag\n8. Push","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgranstrom%2Fsass-extract-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgranstrom%2Fsass-extract-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgranstrom%2Fsass-extract-loader/lists"}