christianwilling / scss Goto Github PK
View Code? Open in Web Editor NEWadds SCSS support to the standard October resource combiner
adds SCSS support to the standard October resource combiner
Is it just me, or did this plugin just simply stopped working?
I had been working on a project and everything worked fine. Now i started working on a new project, i install the plugin and it simply does not work.
<link href="{{ [ 'assets/scss/base.scss' ]|theme }}" rel="stylesheet">
( the file is there, no problem ) generates a stylesheet in combine, like always, but when try to open that in dev inspect i get a 500 error.
An exception has been thrown during the rendering of a template ("Call to undefined method [registerFilter]").
Hi, I am getting this error after install the plugin
Hello,
I get the feeling that there some issues with relative paths for the images inside the scss.
How I include main main scss file
<link href="{{ ['assets/scss/main.scss']|theme }}" rel="stylesheet">
One of my sub scss files has the following declaration:
background-image: url('../img/header_slider_1.png');
The system tells me though:
http://domain.com/img/header_slider_1.png 404 (Not Found)
While the image is in:
domain.com/public/themes/rainlab-vanilla/assets/img
the scss file is in
domain.com/public/themes/rainlab-vanilla/assets/scss
and which includes some files in the sub foldersm, the folder structure is:
After compile :
Undefined variable $i: line: 32
maybe same as : leafo/scssphp#449
Can't compile Bootstrap-4-Alpha
Please can you help ?
FatalErrorException in Plugin.php line 3:
October\Rain\Support\ClassLoader::main(): Failed opening required '/var/www/vhosts/xxxxxxxxx.com/public/plugins/willing/scssvendor/autoload.php' (include_path='.:/opt/plesk/php/7.0/share/pear')
I need to use /themes/mytheme/assets/images/image.jpg
instead of ../images/image.jpg
The newest version dropped this error on me:
An exception has been thrown during the rendering of a template ("Undefined variable $theme-folder: line: 2").
Class 'Willing\Scss\Classes\ScssFilter' not found
/var/www/vhosts/xxxx.com/public/plugins/willing/scss/Plugin.php line 44
TYPE
Twig Template
EXCEPTION
Symfony\Component\Debug\Exception\FatalThrowableError
\System\Classes\CombineAssets::registerCallback(function($combiner) use (&$files){
if ($combiner->useMinify) {
$combiner->registerFilter('scss', new \October\Rain\Support\Filters\StylesheetMinify);
}
//init the filter class with the reverrence to the hash files
$filter = new \Willing\Scss\Classes\ScssFilter($files);
//set the output formate
$filter->setFormatter('Leafo\ScssPhp\Formatter\Expanded');
//set some helpfull variables
$filter->setVariables([
I wrote this in layout file
<link href="{{ [
'assets/styles/normalize.css/normalize.css',
'assets/styles/animate.css/animate.css',
'assets/styles/font-awesome/font-awesome.css',
'assets/styles/app.scss'
] | theme }}" rel="stylesheet">
If I change something in css-file or scss from list above and update some project page - the changes displays, if I change file imported from app.scss - no.
I think changing of imported scss files is not cause assets recombine
app.scss
@import "layout/variables";
@import "layout/functions";
@import "layout/mixins";
@import "layout/reset";
@import "layout/keyframes";
Is there interest to make October theme setting variables available in this plugin and would you accept such a pull request?
I prefer to ask before I'm working, I did something similar for another CMS:
<?
/**
* Compile SCSS with injected variables
* @see http://sass-lang.com/guide
* @author Pascal Garber <[email protected]>
*/
require __DIR__."/vendor/autoload.php";
class Css
{
private $scss = null;
function __construct()
{
$this->scss = new Leafo\ScssPhp\Compiler();
}
/**
* Generates a SASS string with all variables
*
* @param $varArray Array of all variables which should be available in SCSS
* @return SCSS string with variables
*/
private function setVariables($varArray)
{
$scss_variables_string = '';
// Variablen-Array durchlaufen und..
foreach($varArray as $variablePrefix => $vars)
{
// Alle Variablen in $var unter SASS verfuegbar machen
foreach($vars as $key => $value)
{
// nur wenn es kein index wert ist
if(!is_numeric($key))
{
if(is_numeric($value) || is_string($value))
{
// is Number or String
$scss_variables_string.= '$'.$variablePrefix.'_'.$key.': '.$value.";\n";
}
}
}
$scss_variables_string .= "\n";
}
return $scss_variables_string;
}
/**
* Generates a SASS string with imports
*
* @param $importsArray Array of all SCSS files with should be imported
* @return SCSS string with imports
*/
private function setImports($importsArray)
{
$scss_imports_string = '';
foreach($importsArray as $index => $importPath)
{
$scss_imports_string .= "@import '".$importPath."';\n";
}
return $scss_imports_string;
}
/**
* Compile SCSS to CSS string with all variables and imports
*
* @param $name Name of the style for more information
* @param $varArray Array of all variables which should be available in SCSS
* @param $importsArrayArray of all SCSS files with should be imported
* @return CSS string
*/
public function compile($name, $varArray, $importsArray)
{
/**
* Variables for SASS
*/
$scss_variables_string = $this->setVariables($varArray);
/**
* .scss imports
*/
$scss_imports_string = $this->setImports($importsArray);
/**
* Generates a comment for more information
*/
$css_result = "/**\n * Compiled with SCSS\n * \n * @name $name\n * @see http://sass-lang.com/guide/\n */\n\n";
/**
* Generates a comment to the see available variables
*/
$css_result.= "/*\n\nAvailable variables:\n================\n".$scss_variables_string."\n*/\n\n";
/**
* Generates a comment to the see imports
*/
$css_result.= "/*\n\nVerwendete Imports:\n================\n".$scss_imports_string."\n*/\n\n";
/**
* Compiled CSS
*/
// echo ($scss_variables_string."\n".$scss_imports_string);
$css_result .= $this->scss->compile($scss_variables_string."\n".$scss_imports_string);
return $css_result;
}
}
?>
Best wishes,
Pascal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.