{"id":19731355,"url":"https://github.com/cargosense/dart_sass","last_synced_at":"2025-05-15T18:09:56.014Z","repository":{"id":38778620,"uuid":"389195832","full_name":"CargoSense/dart_sass","owner":"CargoSense","description":"Install and run Dart Sass using Elixir.","archived":false,"fork":false,"pushed_at":"2024-12-01T17:03:28.000Z","size":138,"stargazers_count":104,"open_issues_count":6,"forks_count":23,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-08T04:39:20.445Z","etag":null,"topics":["dart-sass","elixir","phoenix-framework","sass"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/dart_sass","language":"Elixir","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/CargoSense.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-24T20:32:52.000Z","updated_at":"2025-02-24T02:33:37.000Z","dependencies_parsed_at":"2024-06-18T21:32:35.226Z","dependency_job_id":"4f5f98b8-5a29-492e-b473-c4a9a9e7a7d7","html_url":"https://github.com/CargoSense/dart_sass","commit_stats":{"total_commits":95,"total_committers":14,"mean_commits":6.785714285714286,"dds":"0.28421052631578947","last_synced_commit":"1d39ccf61d0870872045298c1ade85257edd897b"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CargoSense%2Fdart_sass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CargoSense%2Fdart_sass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CargoSense%2Fdart_sass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CargoSense%2Fdart_sass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CargoSense","download_url":"https://codeload.github.com/CargoSense/dart_sass/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301722,"owners_count":22047948,"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":["dart-sass","elixir","phoenix-framework","sass"],"created_at":"2024-11-12T00:20:33.764Z","updated_at":"2025-05-15T18:09:55.952Z","avatar_url":"https://github.com/CargoSense.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DartSass\n\n[![CI](https://github.com/CargoSense/dart_sass/actions/workflows/ci.yml/badge.svg)](https://github.com/CargoSense/dart_sass/actions/workflows/ci.yml)\n\nMix tasks for installing and invoking [sass](https://github.com/sass/dart-sass/).\n\n## Installation\n\nIf you are going to build assets in production, then you add\n`dart_sass` as a dependency on all environments but only start it\nin dev:\n\n```elixir\ndef deps do\n  [\n    {:dart_sass, \"~\u003e 0.7\", runtime: Mix.env() == :dev}\n  ]\nend\n```\n\nHowever, if your assets are precompiled during development,\nthen it only needs to be a dev dependency:\n\n```elixir\ndef deps do\n  [\n    {:dart_sass, \"~\u003e 0.7\", only: :dev}\n  ]\nend\n```\n\nOnce installed, change your `config/config.exs` to pick your\ndart_sass version of choice:\n\n```elixir\nconfig :dart_sass, version: \"1.77.8\"\n```\n\nNow you can install dart-sass by running:\n\n```bash\n$ mix sass.install\n```\n\nAnd invoke sass with:\n\n```bash\n$ mix sass default assets/css/app.scss priv/static/assets/app.css\n```\n\nIf you need additional load paths you may specify them:\n\n```bash\n$ mix sass default assets/css/app.scss --load-path=assets/node_modules/bulma priv/static/assets/app.css\n```\n\nThe executable may be kept at `_build/sass-TARGET`. However in most cases\nrunning dart-sass requires two files: the portable Dart VM is kept at\n`_build/dart-TARGET` and the Sass snapshot is kept at `_build/sass.snapshot-TARGET`.\nWhere `TARGET` is your system target architecture.\n\n## Profiles\n\nThe first argument to `dart_sass` is the execution profile.\nYou can define multiple execution profiles with the current\ndirectory, the OS environment, and default arguments to the\n`sass` task:\n\n```elixir\nconfig :dart_sass,\n  version: \"1.77.8\",\n  default: [\n    args: ~w(css/app.scss ../priv/static/assets/app.css),\n    cd: Path.expand(\"../assets\", __DIR__)\n  ]\n```\n\nWhen `mix sass default` is invoked, the task arguments will be appended\nto the ones configured above.\n\n## Adding to Phoenix\n\nTo add `dart_sass` to an application using Phoenix, you need only four steps.\nNote that installation requires that Phoenix watchers can accept `MFArgs`\ntuples – so you must have Phoenix \u003e v1.5.9.\n\nFirst add it as a dependency in your `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:phoenix, \"~\u003e 1.7.14\"},\n    {:dart_sass, \"~\u003e 0.7\", runtime: Mix.env() == :dev}\n  ]\nend\n```\n\nNow let's configure `dart_sass` to use `assets/css/app.scss` as the input file and\ncompile CSS to the output location `priv/static/assets/app.css`:\n\n```elixir\nconfig :dart_sass,\n  version: \"1.77.8\",\n  default: [\n    args: ~w(css/app.scss ../priv/static/assets/app.css),\n    cd: Path.expand(\"../assets\", __DIR__)\n  ]\n```\n\n\u003e Note: if you are using esbuild (the default from Phoenix v1.6),\n\u003e make sure you remove the `import \"../css/app.css\"` line at the\n\u003e top of assets/js/app.js so `esbuild` stops generating css files.\n\n\u003e Note: make sure the \"assets\" directory from priv/static is listed\n\u003e in the :only option for Plug.Static in your endpoint file at,\n\u003e for instance `lib/my_app_web/endpoint.ex`.\n\nFor development, we want to enable watch mode. So find the `watchers`\nconfiguration in your `config/dev.exs` and add:\n\n```elixir\n  sass: {\n    DartSass,\n    :install_and_run,\n    [:default, ~w(--embed-source-map --source-map-urls=absolute --watch)]\n  }\n```\n\nNote we are embedding source maps with absolute URLs and enabling the file system watcher.\n\nFinally, back in your `mix.exs`, make sure you have an `assets.deploy`\nalias for deployments, which will also use the `--style=compressed` option:\n\n```elixir\n\"assets.deploy\": [\n  \"esbuild default --minify\",\n  \"sass default --no-source-map --style=compressed\",\n  \"phx.digest\"\n]\n```\n\n## FAQ\n\n### Compatibility with Alpine Linux (`mix sass default` exited with 2)\n\n\u003e Note: Using [glibc on Alpine Linux](https://ariadne.space/2021/08/26/there-is-no-such-thing-as-a-glibc-based-alpine-image/) is **not recommended**. Proceed at your own risk.\n\nDart-native executables rely on [glibc](https://www.gnu.org/software/libc/) to be present. Because Alpine Linux uses [musl](https://musl.libc.org/) instead, you have to add the package [alpine-pkg-glibc](https://github.com/sgerrand/alpine-pkg-glibc) to your installation. Follow the installation guide in the README.\n\nFor example, add the following to your Dockerfile before you\nrun `mix sass`:\n\n```Dockerfile\nENV GLIBC_VERSION=2.34-r0\nRUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \u0026\u0026 \\\n    wget -q -O /tmp/glibc.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \u0026\u0026 \\\n    apk add /tmp/glibc.apk \u0026\u0026 \\\n    rm -rf /tmp/glibc.apk\n```\n\nIn case you get the error `../../runtime/bin/eventhandler_linux.cc: 412: error: Failed to start event handler thread 1`, it means that your Docker installation or the used Docker-in-Docker image, is using a version below Docker 20.10.6. This error is related to an [updated version of the musl library](https://about.gitlab.com/blog/2021/08/26/its-time-to-upgrade-docker-engine). It can be resolved by using the [alpine-pkg-glibc](https://github.com/sgerrand/alpine-pkg-glibc) with the version 2.33 instead of 2.34.\n\nNotes: The Alpine package gcompat vs libc6-compat will not work.\n\n### Watchers and Bash\n\nIn order to ensure graceful termination of the `sass` process\nwhen stdin closes, when the`--watch` option is given then the\nsass process will be invoked by a bash script that will\nhandle the cleanup.\n\n## Acknowledgements\n\nThis package is based on the excellent [esbuild](https://github.com/phoenixframework/esbuild) by Wojtek Mach and José Valim.\n\n## License\n\nCopyright (c) 2021 CargoSense, Inc.\n\ndart_sass source code is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcargosense%2Fdart_sass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcargosense%2Fdart_sass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcargosense%2Fdart_sass/lists"}