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

3
.gitignore vendored
View File

@ -13,3 +13,6 @@ npm-debug.log
temp
.idea
wysija-newsletters.zip
tests/javascript/testBundles
assets/css/*.css
assets/js/*.js

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',

View File

@ -1,629 +0,0 @@
a:focus {
outline: 0 none !important;
}
#mailpoet_form_history {
display:none;
}
#mailpoet_form_editor {
padding:20px;
width:300px;
border:1px solid #ccc;
position: relative;
background-color: #fff;
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1);
}
#mailpoet_form_editor:before, #mailpoet_form_editor:after {
position: absolute;
width: 40%;
height: 10px;
content: ' ';
left: 12px;
bottom: 12px;
background: transparent;
-webkit-transform: skew(-5deg) rotate(-5deg);
-moz-transform: skew(-5deg) rotate(-5deg);
-ms-transform: skew(-5deg) rotate(-5deg);
-o-transform: skew(-5deg) rotate(-5deg);
transform: skew(-5deg) rotate(-5deg);
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
z-index: -1;
}
#mailpoet_form_editor:after
{
left: auto;
right: 12px;
-webkit-transform: skew(5deg) rotate(5deg);
-moz-transform: skew(5deg) rotate(5deg);
-ms-transform: skew(5deg) rotate(5deg);
-o-transform: skew(5deg) rotate(5deg);
transform: skew(5deg) rotate(5deg);
}
/* Warnings in blocks*/
.mailpoet_warning {
font-weight:bold;
color:#900;
}
.block_placeholder {
font-weight: bold;
height: 0;
overflow: hidden;
line-height: 30px;
text-align: center;
border: 0 none;
width:298px;
z-index: 9500;
margin:0 auto;
text-indent: -9999px;
}
.block_placeholder.active {
text-indent: 0;
/*border:1px dashed #dfdfdf;*/
/*background-color:#f5f5f5;*/
background-color: #4cb7e1;
display:block;
overflow: auto;
height: 30px;
}
.block_placeholder.hover {
background-color: #0074a2;
border-color:#0074a2;
color: #fff;
}
.mailpoet_form_block {
background-color:#fff;
height:20px;
border:0 none;
}
.mailpoet_form_block.highlighted {
border:1px solid #5897FB;
padding:9px 17px;
}
.mailpoet_form_block img {
max-width: 100%;
}
/* Widget styles */
.mailpoet_form_block p {
margin:5px 0;
word-wrap: break-word;
}
/* Widget: checkbox, radio */
.mailpoet_radio,
.mailpoet_checkbox {
margin:-2px 5px 0 0;
}
/* MailPoet Form wrapper */
#mailpoet_form_wrapper {
position: relative;
}
/* MailPoet Form container */
#mailpoet_form_container {
width:340px;
margin:0;
}
#mailpoet_form_editor.loading,
#mailpoet_form_toolbar.loading {
background: url(loading.gif) no-repeat center center #fcfcfc;
}
#mailpoet_form_toolbar.loading {
border:1px solid #dfdfdf;
}
#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields {
visibility: hidden;
z-index:1;
}
/* Tabs : content/images/styles/themes */
#wysija-add-field {
float: none;
}
#mailpoet_form_toolbar {
position: absolute;
width: 400px;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs {
border-bottom:1px solid #dfdfdf;
line-height:0;
}
#mailpoet_form_toolbar .add_custom_field {
text-align:center;
padding:15px 0 5px 0;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li,
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
margin:0;
height:30px;
line-height:30px;
padding:0;
display:-moz-inline-box;
display:inline-block;
*display:inline;
*float:left;
outline:0 none;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
outline:0 none; text-decoration:none; color:#a6a6a6;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li {
margin:0 0 1px 0;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a {
font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
background-color: #F5F5F5;
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9');
background: -webkit-gradient(linear, left top,left bottom, from(#F9F9F9), to(#F5F5F5));
border:1px solid #DFDFDF;
-moz-border-radius: 3px 3px 0 0;
-webkit-border-radius: 3px 3px 0 0;
-khtml-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
box-shadow: 0 1px 0 #FFFFFF inset;
padding:0 7px;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover {
background-color:#eee;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected {
color:#000;
border-bottom:0 none;
background:#fcfcfc;
filter:none;
padding-bottom:1px;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a { }
.wysija_params {
display:none !important;
}
#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs,
#mailpoet_form_toolbar #mailpoet_toolbar_fields {
position:relative;
z-index:9998;
margin:0;
}
/* edit form name */
h2.title {
margin:0 0 15px 0;
}
#mailpoet_form_name_input {
vertical-align: bottom;
}
/* wysija widgets */
.mailpoet_form_widget {
width:298px;
height:25px;
line-height:25px;
z-index:9999 !important;
}
.mailpoet_toolbar_section {
margin-bottom: 0;
background: none repeat scroll 0 0 #fff;
border: 1px solid #e5e5e5;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
min-width: 255px;
position: relative;
cursor: pointer;
max-height: auto;
}
.mailpoet_toolbar_section > div {
padding:10px 20px 20px 20px;
}
.mailpoet_toolbar_section h3 {
margin: 10px;
position: relative;
}
.mailpoet_toolbar_section.closed {
max-height:38px;
overflow: hidden;
}
.mailpoet_toolbar_section .mailpoet_toggle {
position: absolute;
top:0;
right: 0;
height: 38px;
width: 27px;
}
.mailpoet_toolbar_section .mailpoet_toggle:focus {
outline: 0 none !important;
box-shadow: none !important;
}
.mailpoet_toolbar_section .mailpoet_toggle:before {
right: 12px;
font: 400 20px/1 dashicons;
speak: none;
display: inline-block;
padding: 8px 10px;
top: 0;
position: relative;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-decoration: none!important;
content: '\f142';
}
.mailpoet_toolbar_section.closed .mailpoet_toggle:before {
content: '\f140';
}
#mailpoet_form_styles {
margin:10px;
max-width: 318px;
width: 318px;
min-height: 300px;
resize:vertical;
}
#mailpoet_form_toolbar a.mailpoet_form_field,
.mailpoet_form_widget {
height:25px;
line-height:25px;
background-color: #F5F5F5;
background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');
background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec));
border:1px solid #DFDFDF;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
box-shadow: 0 1px 0 #FFFFFF inset;
display:block;
font-size: 12px;
font-weight: bold;
padding:0 7px;
cursor:move;
color:#222;
text-shadow: 0 1px 0 #FFFFFF;
}
#mailpoet_form_toolbar a.mailpoet_form_field.disabled {
cursor:pointer;
color:#cccccc;
pointer-events:none;
}
.mailpoet_form_field_edit {
position:absolute;
right:27px;
bottom:13px;
}
.mailpoet_form_field_delete {
position: absolute;
right:7px;
bottom:13px;
}
/* toolbar: fields */
#mailpoet_toolbar_fields li {
padding:0 0 10px 0;
position:relative;
}
#mailpoet_toolbar_fields li.notice {
font-style:italic;
font-size:11px;
margin: 0 !important;
border: 0 none !important;
background: none !important;
}
/* blocks */
.mailpoet_form_block {
position:relative;
margin:0;
padding:10px 18px 10px 18px;
display: inline-table;
display: block;
height: 1%;
margin:0;
z-index:98;
}
.mailpoet_form_block.dragging {
z-index:99000;
pointer-events:none;
}
.mailpoet_form_block:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.mailpoet_form_block.hover {
border:1px dashed #bbb;
margin:0 0 0 0;
padding:9px 17px 9px 17px;
}
.mailpoet_form_block.static {
/*padding:0;
margin:0;*/
background-color:#999;
}
/* controls*/
.mailpoet_form_block .wysija_controls {
background-color:#dfdfdf;
background-image: -moz-linear-gradient(center bottom , #bbb, #eee);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb');
background: -webkit-gradient(linear, left bottom,left top, from(#bbb), to(#eee));
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
-khtml-border-radius: 2px;
border-radius: 2px;
border:1px solid #ccc;
position:absolute;
margin:0;
padding:0;
width:298px;
height:20px;
left:-1px;
right:0;
top:-22px;
}
.mailpoet_form_block .wysija_controls li {
float:left;
width:20px;
height:20px;
}
.mailpoet_form_block .wysija_controls a {
cursor: pointer;
float: left;
font-size: 120%;
font-weight: bold;
height: 20px;
line-height: 20px;
text-align: center;
width: 20px;
color:#000;
}
.mailpoet_form_block .wysija_controls a.remove {
margin:0 0 0 1px;
}
.mailpoet_form_block .handle_container,
.mailpoet_form_block .handle_container a {
float:none;
width:40px !important;
}
.mailpoet_form_block .handle_container {
left: 140px;
top: 0;
position: absolute;
}
/* controls & icons */
.wysija_controls a span,
.wysija_gallery .wysija_tools a span,
.wysija_image .wysija_tools a span,
.wysija_text .wysija_tools a span,
#mailpoet_toolbar_fields a span {
display: block;
height:20px;
width:20px;
}
/* toolbar: full width button */
/* color picker in control bars */
.wysija_controls span input {
margin:2px 0 0 0;
padding: 0;
color: transparent;
}
/* left alignment button */
.alignment-left span {
background:url(form_editor_icons.png) no-repeat 0 0;
}
.alignment-left.active span, .alignment-left:hover span {
background:url(form_editor_icons.png) no-repeat 0 -20px;
}
/* center alignment button */
.alignment-center span {
background:url(form_editor_icons.png) no-repeat -20px 0;
}
.alignment-center.active span, .alignment-center:hover span {
background:url(form_editor_icons.png) no-repeat -20px -20px;
}
/* right alignment button */
.alignment-right span {
background:url(form_editor_icons.png) no-repeat -40px 0;
}
.alignment-right.active span, .alignment-right:hover span {
background:url(form_editor_icons.png) no-repeat -40px -20px;
}
/* linking */
.add-link span {
background:url(form_editor_icons.png) no-repeat -60px 0;
}
.add-link.active span, .add-link:hover span {
background:url(form_editor_icons.png) no-repeat -60px -20px;
}
.remove-link span {
background:url(form_editor_icons.png) no-repeat -80px 0;
}
.remove-link.active span, .remove-link:hover span {
background:url(form_editor_icons.png) no-repeat -80px -20px;
}
/* block controls */
.remove span, .delete span {
background:url(form_editor_icons.png) no-repeat -100px 0;
}
.remove.active span, .remove:hover span,
.delete.active span, .delete:hover span {
background:url(form_editor_icons.png) no-repeat -100px -20px;
}
.handle span {
background: url(handle.png) no-repeat;
cursor:move;
width: 40px !important;
}
.duplicate span {
background:url(form_editor_icons.png) no-repeat -140px 0;
}
.duplicate.active span, .duplicate:hover span {
background:url(form_editor_icons.png) no-repeat -140px -20px;
}
.settings span {
background:url(form_editor_icons.png) no-repeat -160px 0;
}
.settings.active span, .settings:hover span {
background:url(form_editor_icons.png) no-repeat -160px -20px;
}
.icon-plus span {
background:url(form_editor_icons.png) no-repeat -200px 0;
}
.icon-plus.active span, .icon-plus:hover span {
background:url(form_editor_icons.png) no-repeat -200px -20px;
}
.icon-minus span {
background:url(form_editor_icons.png) no-repeat -220px 0;
}
.icon-minus.active span, .icon-minus:hover span {
background:url(form_editor_icons.png) no-repeat -220px -20px;
}
/* wysija options */
.wysija_options {
display:none;
}
/* wysija block settings */
.wysija_settings {
position: absolute;
z-index:1000;
}
.wysija_settings a {
background-color: #F5F5F5;
background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');
background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec));
border:1px solid #DFDFDF;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
box-shadow: 0 1px 0 #FFFFFF inset;
font-size: 12px;
font-weight: normal;
cursor:pointer;
color:#222;
text-shadow: 0 1px 0 #FFFFFF;
text-decoration: none;
display:block;
padding:5px 5px 3px 27px;
}
.wysija_settings a span {
width: 20px;
height: 20px;
position: absolute;
top: 3px;
left: 5px;
}
/* labels */
.mailpoet_form_block label {
margin:0 5px 0 0;
display:block;
}
/* form settings: success message */
#mailpoet_on_success textarea,
#mailpoet_on_success select {
width:100%;
}
#mailpoet_on_success textarea {
height:50px;
min-height: 50px;
resize:vertical;
}
/* make sure textareas within the form editor are not resizeable */
.mailpoet_form_block textarea {
resize:none;
}
/* remove click events from inputs within form editor */
.mailpoet_form_block input,
.mailpoet_form_block textarea {
pointer-events:none;
}
/* form export */
#mailpoet_form_export textarea {
width:340px;
height:150px;
min-height: 150px;
resize:vertical;
font-size:85%;
display:none;
}
/** Styling for WP 3.8 and higher */
.mailpoet_form_field_edit,
.mailpoet_form_field_delete {
text-decoration: none;
}
.mailpoet_form_field_edit:hover .dashicons-admin-generic:before,
.mailpoet_form_field_delete:hover .dashicons-dismiss:before,
.settings:hover .dashicons-admin-generic:before {
color: #2ea2cc;
}
.mailpoet_form_field_edit span,
.mailpoet_form_field_delete span {
background: none !important;
color: #999;
}
.mailpoet_form_field_delete span:before {
font-size: 21px;
}
/* Code Mirror */
.CodeMirror {
border: 1px solid #eee;
}

View File

@ -7,7 +7,6 @@ webpackJsonp([0],[
__webpack_require__(2),
__webpack_require__(3),
], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) {
console.log('OVER HERE', MailPoet, jQuery, Handlebars);
jQuery(function($) {
// dom ready
$(function() {

View File

@ -3,7 +3,6 @@ define('admin', [
'jquery',
'handlebars',
], function(MailPoet, jQuery, Handlebars) {
console.log('admin.js', MailPoet, jQuery, Handlebars);
jQuery(function($) {
// dom ready
$(function() {