• Properties

  • Git HTTP https://git.kmx.io/kmx.io/dart_sass.git
    Git SSH git@git.kmx.io:kmx.io/dart_sass.git
    Public access ? public
    Description

    An installer for sass.

    Users
    thodg
    Tags

  • README.md

  • DartSass

    CI

    Mix tasks for installing and invoking sass.

    Installation

    If you are going to build assets in production, then you add dart_sass as a dependency on all environments but only start it in dev:

    def deps do
      [
        {:dart_sass, "~> 0.1", runtime: Mix.env() == :dev}
      ]
    end

    However, if your assets are precompiled during development, then it only needs to be a dev dependency:

    def deps do
      [
        {:dart_sass, "~> 0.1", only: :dev}
      ]
    end

    Once installed, change your config/config.exs to pick your dart_sass version of choice:

    config :dart_sass, version: "1.36.0"

    Now you can install dart_sass by running:

    $ mix dart_sass.install

    And invoke dart_sass with:

    $ mix dart_sass default assets/css/app.scss priv/static/assets/app.css

    If you need additional load paths you may specify them:

    $ mix dart_sass default assets/css/app.scss -I assets/node_modules/bulma priv/static/assets/app.css

    The executable is kept at _build/sass.

    Profiles

    The first argument to dart_sass is the execution profile. You can define multiple execution profiles with the current directory, the OS environment, and default arguments to the dart_sass task:

    config :dart_sass,
      version: "1.36.0",
      default: [
        args: ~w(css/app.scss ../priv/static/assets/app.css),
        cd: Path.expand("../assets", __DIR__)
      ]

    When mix sass default is invoked, the task arguments will be appended to the ones configured above.

    Acknowledgements

    This package is based on the excellent esbuild by Wojtek Mach and José Valim.

    License

    Copyright (c) 2021 CargoSense, Inc.

    dart_sass source code is licensed under the MIT License.