Replace Stylus with SCSS, update watch and compile tasks
[MAILPOET-1813]
This commit is contained in:
@@ -53,7 +53,7 @@ $ ./do compile:all
|
|||||||
- [Docker](https://www.docker.com/), [Docker Compose](https://docs.docker.com/compose/) and [Selenium](https://www.seleniumhq.org/) to run acceptance tests.
|
- [Docker](https://www.docker.com/), [Docker Compose](https://docs.docker.com/compose/) and [Selenium](https://www.seleniumhq.org/) to run acceptance tests.
|
||||||
- [React](https://reactjs.org/) is used to create most of UIs.
|
- [React](https://reactjs.org/) is used to create most of UIs.
|
||||||
- [Marionette](https://marionettejs.com/) is used to build the newsletters editor.
|
- [Marionette](https://marionettejs.com/) is used to build the newsletters editor.
|
||||||
- [Stylus](http://stylus-lang.com/) is used to write styles.
|
- [SCSS](http://sass-lang.com/) is used to write styles.
|
||||||
- [Mocha](https://mochajs.org/), [Chai](https://www.chaijs.com/) and [Sinon](https://sinonjs.org/) are used to write Javascript tests.
|
- [Mocha](https://mochajs.org/), [Chai](https://www.chaijs.com/) and [Sinon](https://sinonjs.org/) are used to write Javascript tests.
|
||||||
- [ESLint](https://eslint.org/) is used to lint JS files.
|
- [ESLint](https://eslint.org/) is used to lint JS files.
|
||||||
- [Webpack](https://webpack.js.org/) is used to bundle assets.
|
- [Webpack](https://webpack.js.org/) is used to bundle assets.
|
||||||
@@ -64,7 +64,7 @@ $ ./do compile:all
|
|||||||
$ ./do install # install PHP and JS dependencies
|
$ ./do install # install PHP and JS dependencies
|
||||||
$ ./do update # update PHP and JS dependencies
|
$ ./do update # update PHP and JS dependencies
|
||||||
|
|
||||||
$ ./do compile:css # compiles Stylus files into CSS.
|
$ ./do compile:css # compiles SCSS files into CSS.
|
||||||
$ ./do compile:js # bundles JS files for the browser.
|
$ ./do compile:js # bundles JS files for the browser.
|
||||||
$ ./do compile:all # compiles CSS and JS files.
|
$ ./do compile:all # compiles CSS and JS files.
|
||||||
|
|
||||||
|
34
RoboFile.php
34
RoboFile.php
@@ -43,7 +43,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function watch() {
|
function watch() {
|
||||||
$css_files = $this->rsearch('assets/css/src/', array('styl'));
|
$css_files = $this->rsearch('assets/css/src/', array('scss'));
|
||||||
$js_files = $this->rsearch('assets/js/src/', array('js', 'jsx'));
|
$js_files = $this->rsearch('assets/js/src/', array('js', 'jsx'));
|
||||||
|
|
||||||
$this->taskWatch()
|
$this->taskWatch()
|
||||||
@@ -57,7 +57,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function watchCss() {
|
function watchCss() {
|
||||||
$css_files = $this->rsearch('assets/css/src/', array('styl'));
|
$css_files = $this->rsearch('assets/css/src/', array('scss'));
|
||||||
$this->taskWatch()
|
$this->taskWatch()
|
||||||
->monitor($css_files, function() {
|
->monitor($css_files, function() {
|
||||||
$this->compileCss();
|
$this->compileCss();
|
||||||
@@ -97,23 +97,23 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
// Clean up folder from previous files
|
// Clean up folder from previous files
|
||||||
array_map('unlink', glob("assets/dist/css/*.*"));
|
array_map('unlink', glob("assets/dist/css/*.*"));
|
||||||
|
|
||||||
$css_files = array(
|
$scss_files = array(
|
||||||
'assets/css/src/admin.styl',
|
'assets/css/src/admin.scss',
|
||||||
'assets/css/src/admin-global.styl',
|
'assets/css/src/adminGlobal.scss',
|
||||||
'assets/css/src/newsletter_editor/newsletter_editor.styl',
|
'assets/css/src/newsletterEditor.scss',
|
||||||
'assets/css/src/public.styl',
|
'assets/css/src/public.scss',
|
||||||
'assets/css/src/rtl.styl',
|
'assets/css/src/rtl.scss',
|
||||||
'assets/css/src/importExport.styl'
|
'assets/css/src/importExport.scss',
|
||||||
);
|
);
|
||||||
|
|
||||||
$compilation_result = $this->_exec(join(' ', array(
|
foreach ($scss_files as $file) {
|
||||||
'./node_modules/stylus/bin/stylus',
|
$compilation_result = $this->_exec(join(' ', array(
|
||||||
'--include ./node_modules',
|
'./node_modules/node-sass/bin/node-sass',
|
||||||
'--include-css',
|
$file,
|
||||||
'-u nib',
|
'--output assets/dist/css/',
|
||||||
join(' ', $css_files),
|
'--output-style compact',
|
||||||
'-o assets/dist/css/'
|
)));
|
||||||
)));
|
}
|
||||||
|
|
||||||
// Create manifest file
|
// Create manifest file
|
||||||
$manifest = [];
|
$manifest = [];
|
||||||
|
@@ -61,7 +61,7 @@ class Capabilities {
|
|||||||
function enqueueMembersStyles() {
|
function enqueueMembersStyles() {
|
||||||
wp_enqueue_style(
|
wp_enqueue_style(
|
||||||
'mailpoet-admin-global',
|
'mailpoet-admin-global',
|
||||||
Env::$assets_url . '/dist/css/' . $this->renderer->getCssAsset('admin-global.css')
|
Env::$assets_url . '/dist/css/' . $this->renderer->getCssAsset('adminGlobal.css')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4135
package-lock.json
generated
4135
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -83,10 +83,9 @@
|
|||||||
"jsdom": "^11.12.0",
|
"jsdom": "^11.12.0",
|
||||||
"json-loader": "^0.5.7",
|
"json-loader": "^0.5.7",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"nib": "~1.1.2",
|
"node-sass": "^4.11.0",
|
||||||
"sinon": "1.14.1",
|
"sinon": "1.14.1",
|
||||||
"sinon-chai": "2.7.0",
|
"sinon-chai": "2.7.0",
|
||||||
"stylus": "~0.54.5",
|
|
||||||
"terser-webpack-plugin": "^1.2.2",
|
"terser-webpack-plugin": "^1.2.2",
|
||||||
"webpack": "^4.28.1",
|
"webpack": "^4.28.1",
|
||||||
"webpack-cli": "^3.2.1",
|
"webpack-cli": "^3.2.1",
|
||||||
|
@@ -377,7 +377,7 @@
|
|||||||
|
|
||||||
<% block after_css %>
|
<% block after_css %>
|
||||||
<%= stylesheet(
|
<%= stylesheet(
|
||||||
'newsletter_editor.css'
|
'newsletterEditor.css'
|
||||||
) %>
|
) %>
|
||||||
<% endblock %>
|
<% endblock %>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user