Skip to content

Commit 423d268

Browse files
committed
scss compiler:
- add scssphp sub module - modify ext/arty/scss/acp/scss_module.php to run scssphp
1 parent b11006b commit 423d268

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ext/arty/scss/acp/scss_module.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace arty\scss\acp;
1212

13+
require_once( __DIR__ . '/scssphp/scss.inc.php' );
14+
use ScssPhp\ScssPhp\Compiler;
15+
1316
class scss_module
1417
{
1518
/** @var string */
@@ -180,6 +183,7 @@ protected function compile($style, $path)
180183
'files' => array(),
181184
);
182185

186+
/*
183187
foreach ($scss as $file)
184188
{
185189
if ($file == 'stylesheet.scss')
@@ -188,7 +192,14 @@ protected function compile($style, $path)
188192
}
189193
$post['files'][$file] = @file_get_contents($path . $file);
190194
}
191-
195+
*/
196+
197+
$compiler = new Compiler();
198+
$compiler->setOutputStyle = \ScssPhp\ScssPhp\OutputStyle::EXPANDED;
199+
$cssResult = $compiler->compileString( $data, $path . 'stylesheet.scss' )->getCss();
200+
$result = json_encode( array('css' => $cssResult ) );
201+
202+
/*
192203
// Send data to server
193204
$url = 'http://phpbb31.artodia.com/scss.php';
194205
@@ -202,6 +213,7 @@ protected function compile($style, $path)
202213
'Content-Length: ' . strlen($encoded))
203214
);
204215
$result = curl_exec($ch);
216+
*/
205217

206218
if (!strlen($result))
207219
{
@@ -323,10 +335,12 @@ protected function find_scss_files($path, $prefix = '')
323335
*/
324336
protected function assert_required_modules()
325337
{
338+
/*
326339
if (!function_exists('curl_init'))
327340
{
328341
trigger_error($this->user->lang['ACP_SCSS_MISSING_CURL'] . adm_back_link($this->u_action), E_USER_WARNING);
329342
}
343+
*/
330344
if (!function_exists('json_encode'))
331345
{
332346
trigger_error($this->user->lang['ACP_SCSS_MISSING_JSON'] . adm_back_link($this->u_action), E_USER_WARNING);

ext/arty/scss/acp/scssphp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit c800975c7408e923309fbb51346b84e83dd05700

0 commit comments

Comments
 (0)