2017 © Pedro Peláez
 

library yii2-sass

compiles sass assets

image

danxill/yii2-sass

compiles sass assets

  • Friday, March 23, 2018
  • by DanxilL
  • Repository
  • 1 Watchers
  • 4 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 109 % Grown

The README.md

Yii2 sass compiler

compiles sass assets, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

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

or add, (*4)

"danxill/yii2-sass": "*"

to the require section of your composer.json file., (*5)

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

'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

Once the extension is installed, simply use it in your code by :, (*6)

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));
    }



}

The Versions

23/03 2018

dev-master

9999999-dev

compiles sass assets

  Sources   Download

MIT

The Requires

 

by Dmitriy Bulgar

extension yii2 sass

23/03 2018

dev-test

dev-test

compiles sass assets

  Sources   Download

MIT

The Requires

 

by Dmitriy Bulgar

extension yii2 sass

23/03 2018

0.1.x-dev

0.1.9999999.9999999-dev

compiles sass assets

  Sources   Download

MIT

The Requires

 

by Dmitriy Bulgar

extension yii2 sass