PHPackages                             danxill/yii2-sass - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. danxill/yii2-sass

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

danxill/yii2-sass
=================

compiles sass assets

0.1.x-dev(8y ago)64.1k1[1 issues](https://github.com/DanxilL/yii2-sass/issues)MITPHP

Since Mar 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DanxilL/yii2-sass)[ Packagist](https://packagist.org/packages/danxill/yii2-sass)[ RSS](/packages/danxill-yii2-sass/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Yii2 sass compiler
==================

[](#yii2-sass-compiler)

compiles sass assets

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist danxill/yii2-sass "*"

```

or add

```
"danxill/yii2-sass": "*"

```

to the require section of your `composer.json` file.

Simple configuration to web app with themes
-------------------------------------------

[](#simple-configuration-to-web-app-with-themes)

```
'components' => array(
    ...
    'sass'= [
        // Path to the SassHandler class
        'class' => '\danxill\sass\SassHandler',
        // Enable Compass support, defaults to false
        'enableCompass' => true,
        'sassCompiledPath' => $basePath.'\websites\\'.$site.'\\css',
    ];
```

Configuration
-------------

[](#configuration)

```
'components' => array(
    ...
   'sass' => [
               // Path to the SassHandler class
               'class' => '\danxill\sass\SassHandler',
               // Enable Compass support, defaults to false
               'enableCompass' => true,

               //By default it is '@runtime/sass-cache'
                'cachePath' => '@runtime/sass-cache',

               // Path to a directory with compiled CSS files.
               // Will be created automatically if it doesn't exist.
               // Will be chmod'ed to become writable,
               // see "writableDirectoryPermissions" parameter.
               // Yii aliases can be used.
               // Defaults to '@web/css-compiled'
               'sassCompiledPath' => '@web/css-compiled',

               // Force compilation/recompilation on each request.
               // False value means that compilation will be done only if
               // source SCSS file or related imported files have been
               // changed after previous compilation.
               // Defaults to false
               'forceCompilation' => false,

               // Turn on/off overwriting of already compiled CSS files.
               // Will be ignored if "forceCompilation" parameter's value is true.
               //
               // True value means that compiled CSS file will be overwriten
               // if the source SCSS file or related imported files have
               // been changed after previous compilation.
               //
               // False value means that compilation will be done only if
               // an output CSS file doesn't exist.
               //
               // Defaults to true
               'allowOverwrite' => true,

               // Automatically add directory containing SCSS file being processed
               // as an import path for the @import Sass directive.
               // Defaults to true
               'autoAddCurrentDirectoryAsImportPath' => true,

               // List of import paths.
               // Can be a list of strings or callable functions:
               // function($searchPath) {return $targetPath;}
               // Defaults to an empty array
               'importPaths' => array(),

               // Chmod permissions used for creating/updating of writable
               // directories for cache files and compiled CSS files.
               // Mind the leading zero for octal values.
               // Defaults to 0777
               'writableDirectoryPermissions' => 0777,

               // Chmod permissions used for creating/updating of writable
               // cache files and compiled CSS files.
               // Mind the leading zero for octal values.
               // Defaults to 0666
               'writableFilePermissions' => 0666,

               // Customize the formatting of the output CSS.
               // Use one of the SassHandler::OUTPUT_FORMATTING_* constants
               // to set the formatting type.
               // @link http://leafo.net/scssphp/docs/#output_formatting
               // Default is OUTPUT_FORMATTING_NESTED
               'compilerOutputFormatting' => SassHandler::OUTPUT_FORMATTING_NESTED,

               // Id of the cache application component.
               // Defaults to 'cache' (the primary cache application component)
               'cacheComponentId' => 'cache',
           ],
    ...
),
```

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
namespace app\assets;

use Yii;
use yii\web\AssetBundle;

class ThemeAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'scss/site.scss',
    ];
    public $js = [
    ];

    public function init()
    {
        parent::init();
        $this->css = Yii::$app->sass->publishAndGetPathArray($this->css,Yii::getAlias($this->baseUrl));
    }

}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2972d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef3ed30f2543b6f3225a64b1112c158e7ab3b4e01f1c2f4ed9baad4b6ec37e05?d=identicon)[DanxilL](/maintainers/DanxilL)

---

Top Contributors

[![DanxilL](https://avatars.githubusercontent.com/u/11357457?v=4)](https://github.com/DanxilL "DanxilL (12 commits)")

---

Tags

sassyii2extension

### Embed Badge

![Health badge](/badges/danxill-yii2-sass/health.svg)

```
[![Health](https://phpackages.com/badges/danxill-yii2-sass/health.svg)](https://phpackages.com/packages/danxill-yii2-sass)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
