Skip to content

Commit 3ee471e

Browse files
committed
init
0 parents  commit 3ee471e

File tree

5 files changed

+106
-0
lines changed

5 files changed

+106
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
composer.lock
2+
vendor
3+
/compass/

compass.inc.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
class scss_compass {
4+
protected $libFunctions = array("lib_compact");
5+
6+
static public $true = array("keyword", "true");
7+
static public $false = array("keyword", "false");
8+
9+
public function __construct($scss) {
10+
$this->scss = $scss;
11+
$this->updateImportPath();
12+
$this->registerFunctions();
13+
}
14+
15+
protected function updateImportPath() {
16+
$this->scss->addImportPath(__DIR__ . "/stylesheets/");
17+
}
18+
19+
protected function registerFunctions() {
20+
foreach ($this->libFunctions as $fn) {
21+
$registerName = $fn;
22+
if (preg_match('/^lib_(.*)$/', $fn, $m)) {
23+
$registerName = $m[1];
24+
}
25+
$this->scss->registerFunction($registerName, array($this, $fn));
26+
}
27+
}
28+
29+
public function lib_compact($args) {
30+
list($list) = $args;
31+
if ($list[0] != "list") return $list;
32+
33+
$filtered = array();
34+
foreach ($list[2] as $item) {
35+
if ($item != self::$false) $filtered[] = $item;
36+
}
37+
$list[2] = $filtered;
38+
return $list;
39+
}
40+
}
41+

composer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "leafo/scssphp-compass",
3+
"description": "Compass for scssphp",
4+
"homepage": "http://leafo.net/scssphp/",
5+
"require": {
6+
"leafo/scssphp": "dev-master"
7+
},
8+
"authors": [
9+
{
10+
"name": "Leaf Corcoran",
11+
"email": "leafot@gmail.com",
12+
"homepage": "http://leafo.net"
13+
}
14+
],
15+
"autoload": {
16+
"classmap": ["compass.inc.php"]
17+
}
18+
}

rebuild.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
STYLESHEETS="stylesheets"
4+
5+
if [ -d compass ]; then
6+
(
7+
cd compass
8+
git pull
9+
)
10+
else
11+
git clone https://github.com/chriseppstein/compass.git
12+
fi
13+
14+
[ -d "$STYLESHEETS" ] && rm -r "$STYLESHEETS"
15+
mkdir "$STYLESHEETS"
16+
17+
cp -r compass/frameworks/compass/stylesheets/* "$STYLESHEETS"
18+
19+
# rename all the files
20+
for file in $(find "$STYLESHEETS" | grep scss$); do
21+
out=$(echo $file | sed -e 's/\/_\([^\/]*\.scss\)$/\/\1/')
22+
if [ $file != $out ]; then
23+
# echo " -> " "$out"
24+
mv "$file" "$out"
25+
fi
26+
done
27+
28+

test.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require "vendor/autoload.php";
4+
require "compass.inc.php";
5+
6+
$scss = new scssc();
7+
new scss_compass($scss);
8+
9+
echo $scss->compile('
10+
@import "compass";
11+
12+
div {
13+
@include box-shadow(10px 10px 8px red);
14+
}
15+
');
16+

0 commit comments

Comments
 (0)