Skip to content

Commit

Permalink
build: update css build and minify
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jun 13, 2021
1 parent f57d04f commit a56cbf2
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 12 deletions.
4 changes: 1 addition & 3 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ public function archiveBuild($release = 'release') {
->run();

// Compile SCSS
$this->taskExec(__DIR__ . "/../../bin/console")
->arg('glpi:plugin:formcreator:scss')
->run();
$this->minifyCSS();

$rev = 'HEAD';
$pluginName = $this->getPluginName();
Expand Down
15 changes: 8 additions & 7 deletions RoboFilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ public function minify() {
/**
* Minify CSS stylesheets
*
* @return void
* @return RoboFilePlugin
*/
public function minifyCSS() {
public function minifyCSS(): RoboFilePlugin {
$css_dir = __DIR__ . '/css';
if (is_dir($css_dir)) {
foreach (glob("$css_dir/*.css") as $css_file) {
foreach (glob("$css_dir/*.scss") as $css_file) {
$outfile = dirname(dirname($css_file)) . '/css_compiled/' . basename($css_file, '.scss').'.css';
if (!$this->endsWith($css_file, 'min.css')) {
$this->taskMinify($css_file)
->to(str_replace('.css', '.min.css', $css_file))
->type('css')
->run();
$this->taskScss([
$css_file => $outfile,
])->run();
$this->taskMinify($outfile)->run();
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"glpi-project/coding-standard": "^0.7.1",
"php-parallel-lint/php-parallel-lint": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcsstandards/phpcsutils": "^1.0@alpha"
"phpcsstandards/phpcsutils": "^1.0@alpha",
"scssphp/scssphp": "^1.5"
},
"autoload-dev": {
"psr-4": {
Expand Down
75 changes: 74 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a56cbf2

Please sign in to comment.