1. Go to this page and download the library: Download artem-frolov/yii-sass library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
artem-frolov / yii-sass example snippets
'aliases' => array(
...
// Path to your Composer's "vendor" directory
// You can remove this if you use Composer's autoloader and Yii >= 1.1.15
'vendor' => __DIR__ . '/../../../vendor',
),
...
'components' => array(
...
'sass' => array(
// Path to the SassHandler class
// You need the full path only if you don't use Composer's autoloader
'class' => 'vendor.artem-frolov.yii-sass.SassHandler',
// Use the following if you use Composer's autoloader and Yii >= 1.1.15
//'class' => 'SassHandler',
// Enable Compass support, defaults to false
'enableCompass' => true,
),
...
),
'components' => array(
...
'sass' => array(
// Path to the SassHandler class
'class' => 'ext.yii-sass.SassHandler',
// Path and filename of scss.inc.php
'compilerPath' => __DIR__ . '/../vendor/scssphp/scss.inc.php',
// Path and filename of compass.inc.php
// Required only if Compass support is needed
'compassPath' => __DIR__ . '/../vendor/scssphp-compass/compass.inc.php',
// Enable Compass support, defaults to false
'enableCompass' => true,
),
...
),
'components' => array(
...
'sass' => array(
// Path to the SassHandler class
'class' => 'vendor.artem-frolov.yii-sass.SassHandler',
// Path and filename of scss.inc.php
// Defaults to the relative location in Composer's vendor directory
'compilerPath' => __DIR__ . "/../../../vendor/leafo/scssphp/scss.inc.php",
// Path and filename of compass.inc.php
// Required only if Compass support is needed
// Defaults to the relative location in Composer's vendor directory
'compassPath' => __DIR__ . '/../../../vendor/leafo/scssphp-compass/compass.inc.php',
// Path for cache files. Will be used if Yii caching is not enabled.
// Will be chmod'ed to become writable,
// see "writableDirectoryPermissions" parameter.
// Yii aliases can be used.
// Defaults to 'application.runtime.sass-cache'
'cachePath' => 'application.runtime.sass-cache',
// Enable Compass support.
// Automatically add rted 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,
// Default value for $hashByName parameter in extension's methods.
// $hashByName value determines whether the published file should be named
// as the hashed basename. If false, the name will be the hash taken
// from dirname of the path being published and path mtime.
//
// Set to true if the path being published is shared
// among different extensions.
//
// Defaults to false
// @see CAssetManager::publish()
'defaultHashByName' => false,
// 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',
),
...
),
/**
* Publish and register compiled CSS file.
* Compile/recompile source SCSS file if needed.
*
* Optionally can publish compiled CSS file inside specific published directory.
* It's helpful when CSS code has relative references to other
* resources (images/fonts) and when these resources are also published
* using Yii asset manager. This method allows to publish compiled CSS files
* along with other resources to make relative references work.
*
* E.g.:
* "image.jpg" is stored inside path alias "application.files.images"
* Somewhere in the code the following is called during page generation:
* Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.files'));
* SCSS file has the following code: background-image: url(../images/image.jpg);
* Then the correct call of the method will be:
* Yii::app()->sass->register(
* 'path-to-scss-file.scss',
* '',
* 'application.files',
* 'css_compiled'
* );
*
* @param string $sourcePath Path to the source SCSS file
* @param string $media Media that the CSS file should be applied to.
* If empty,it means all media types
* @param string $insidePublishedDirectory Path to the directory with
* resource files which is published somewhere in the application explicitly.
* Default is null which means that CSS file will be published separately.
* @param string $subDirectory Subdirectory for the CSS file within
* publicly available location. Default is null
* @param boolean $hashByName Must be the same as in the CAssetManager::publish() call
* for $insidePublishedDirectory. See CAssetManager::publish() for details.
* "defaultHashByName" plugin parameter's value is used by default.
*/
Yii::app()->sass->register(
$sourcePath,
$media = '',
$insidePublishedDirectory = null,
$subDirectory = null,
$hashByName = null
);
/**
* Publish compiled CSS file.
* Compile/recompile source SCSS file if needed.
*
* Optionally can publish compiled CSS file inside specific published directory.
* It's helpful when CSS code has relative references to other
* resources (images/fonts) and when these resources are also published
* using Yii asset manager. This method allows to publish compiled CSS files
* along with other resources to make relative references work.
*
* E.g.:
* "image.jpg" is stored inside path alias "application.files.images"
* Somewhere in the code the following is called during page generation:
* Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.files'));
* SCSS file has the following code: background-image: url(../images/image.jpg);
* Then the correct call of the method will be:
* Yii::app()->sass->publish('path-to-scss-file.scss', 'application.files', 'css_compiled');
*
* @param string $sourcePath Path to the source SCSS file
* @param string $insidePublishedDirectory Path to the directory with resource files
* which is published somewhere in the application explicitly.
* Default is null which means that CSS file will be published separately.
* @param string $subDirectory Subdirectory for the CSS file within publicly
* available location. Default is null
* @param boolean $hashByName Must be the same as in the CAssetManager::publish() call
* for $insidePublishedDirectory. See CAssetManager::publish() for details.
* "defaultHashByName" plugin parameter's value is used by default.
* @return string URL of the published CSS file
*/
Yii::app()->sass->publish(
$sourcePath,
$insidePublishedDirectory = null,
$subDirectory = null,
$hashByName = null
);
/**
* Get path to the compiled CSS file, compile/recompile source file if needed
*
* @param string $sourcePath Path to the source SCSS file
* @throws CException
* @return string
*/
Yii::app()->sass->getCompiledFile($sourcePath);
/**
* Compile SCSS file
*
* @param string $sourcePath
* @throws CException
* @return string Compiled CSS code
*/
Yii::app()->sass->compile($sourcePath);
/**
* Get compiler
* Loads
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.