Update Robo task to compile assets

- renamed compile:javascript to compile:js
- renamed compile:styles to compile:css
- added compile:all to compile all of our assets
- added compiled js & css to gitignore
- removed console.log from src/admin.js
This commit is contained in:
Jonathan Labreuille
2015-08-17 15:04:30 +02:00
parent 6ed4ce0de2
commit cf3695157a
5 changed files with 24 additions and 649 deletions

View File

@@ -1,6 +1,14 @@
<?php
class RoboFile extends \Robo\Tasks {
private $css_files = array(
'assets/css/src/admin.styl',
'assets/css/src/rtl.styl'
);
private $js_files = 'assets/js/src/*.js';
function install() {
$this->_exec('./composer.phar install');
$this->_exec('npm install');
@@ -13,35 +21,30 @@ class RoboFile extends \Robo\Tasks {
}
function watch() {
$css_files = array(
'assets/css/src/admin.styl',
'assets/css/src/rtl.styl'
);
$js_files = glob('assets/js/src/*.js');
$this->taskWatch()
->monitor($js_files, function() {
$this->compileJavascript();
->monitor(glob($this->js_files), function() {
$this->compileJs();
})
->monitor($css_files, function() use($css_files) {
$this->compileStyles($css_files);
->monitor($this->css_files, function() {
$this->compileCss();
})
->run();
}
function compileJavascript() {
function compileAll() {
$this->compileJs();
$this->compileCss();
}
function compileJs() {
$this->_exec('./node_modules/webpack/bin/webpack.js');
}
protected function compileStyles($files = array()) {
if(empty($files)) { return; }
function compileCss() {
$this->_exec(join(' ', array(
'./node_modules/stylus/bin/stylus',
'-u nib',
'-w',
join(' ', $files),
join(' ', $this->css_files),
'-o assets/css/'
)));
}
@@ -78,7 +81,7 @@ class RoboFile extends \Robo\Tasks {
}
function testJavascript() {
$this->compileJavascript();
$this->compileJs();
$this->_exec(join(' ', array(
'./node_modules/mocha/bin/mocha',