Skip to content

Commit 51a1d78

Browse files
committed
improving project
1 parent 1bafd0f commit 51a1d78

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ use Phulp\ScssCompiler\ScssCompiler;
1717

1818
$phulp->task('scss', function ($phulp) {
1919
$phulp->src(['src/'], '/scss$/')
20-
->pipe(new ScssCompiler);
20+
// compile
21+
->pipe(new ScssCompiler)
22+
// write your compiled files
23+
->pipe($phulp->dest('dist/'));
2124
});
2225

2326
```
@@ -31,6 +34,9 @@ $phulp->task('scss', function ($phulp) {
3134

3235
use Phulp\ScssCompiler\ScssCompiler;
3336

34-
$compiler = new ScssCompiler(['import_paths' => ['src/styles/']]);
37+
$compiler = new ScssCompiler([
38+
// default: null
39+
'import_paths' => ['src/styles/']
40+
]);
3541

3642
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "reisraff/phulp-scss-compiler",
33
"description": "The scss-compiler addon for phulp",
4-
"keywords": ["phulpplugin", "phulp", "php", "scss-compiler"],
4+
"keywords": ["phulpplugin", "phulp", "php", "scss-compiler", "compiler", "scss"],
55
"license": "MIT",
66
"type": "library",
77
"authors": [

src/ScssCompiler.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,15 @@ public function __construct(array $options = [])
2929
public function execute(\Phulp\Source $src)
3030
{
3131
foreach ($src->getDistFiles() as $key => $file) {
32-
if (preg_match('/\.scss$/', $file->getName()) || preg_match('/\.scss$/', $file->getDistpathname())) {
33-
$scss = new Compiler();
32+
$scss = new Compiler();
3433

35-
if ($this->options['import_paths'] && is_array($this->options['import_paths'])) {
36-
$scss->setImportPaths($this->options['import_paths']);
37-
}
38-
39-
$css = $scss->compile($file->getContent());
40-
$file->setContent($css);
41-
$file->setDistpathname(preg_replace('/scss$/', 'css', $file->getDistpathname()));
34+
if ($this->options['import_paths'] && is_array($this->options['import_paths'])) {
35+
$scss->setImportPaths($this->options['import_paths']);
4236
}
37+
38+
$css = $scss->compile($file->getContent());
39+
$file->setContent($css);
40+
$file->setDistpathname(preg_replace('/scss$/', 'css', $file->getDistpathname()));
4341
}
4442
}
4543
}

0 commit comments

Comments
 (0)