added symlink dependencies for node_modules in Robo
This commit is contained in:
10
RoboFile.php
10
RoboFile.php
@ -3,11 +3,21 @@ class RoboFile extends \Robo\Tasks {
|
||||
function install() {
|
||||
$this->_exec('./composer.phar install');
|
||||
$this->_exec('npm install');
|
||||
$this->symlinkDependencies();
|
||||
}
|
||||
|
||||
function update() {
|
||||
$this->_exec('./composer.phar update');
|
||||
$this->_exec('npm update');
|
||||
$this->symlinkDependencies();
|
||||
}
|
||||
|
||||
function symlinkDependencies() {
|
||||
// handlebars
|
||||
$this->_symlink(
|
||||
__DIR__.'/node_modules/handlebars/dist/handlebars.min.js',
|
||||
__DIR__.'/assets/js/handlebars/handlebars.min.js'
|
||||
);
|
||||
}
|
||||
|
||||
function testUnit() {
|
||||
|
1
assets/js/handlebars/handlebars.min.js
vendored
Symbolic link
1
assets/js/handlebars/handlebars.min.js
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
/Users/jonathan/work/namp2/node_modules/handlebars/dist/handlebars.min.js
|
@ -43,8 +43,10 @@ class Initializer {
|
||||
);
|
||||
|
||||
// renderer: global variables
|
||||
// $this->renderer->addGlobal('assets_url', $this->assets_url);
|
||||
$this->renderer->addExtension(new Renderer\Assets($this->assets_url));
|
||||
$this->renderer->addExtension(new Renderer\Assets(array(
|
||||
'assets_url' => $this->assets_url,
|
||||
'assets_path' => $this->assets_path
|
||||
)));
|
||||
|
||||
register_activation_hook(
|
||||
$this->file,
|
||||
|
@ -3,10 +3,10 @@ namespace MailPoet\Renderer;
|
||||
|
||||
class Assets extends \Twig_Extension {
|
||||
|
||||
public $assets_url;
|
||||
private $_globals;
|
||||
|
||||
public function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
public function __construct($globals) {
|
||||
$this->_globals = $globals;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
@ -14,9 +14,7 @@ class Assets extends \Twig_Extension {
|
||||
}
|
||||
|
||||
public function getGlobals() {
|
||||
return array(
|
||||
'assets_url' => $this->assets_url
|
||||
);
|
||||
return $this->_globals;
|
||||
}
|
||||
|
||||
public function getFunctions() {
|
||||
@ -42,7 +40,7 @@ class Assets extends \Twig_Extension {
|
||||
$output[] = '<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="'.$this->assets_url.'/css/'.$stylesheet.'"
|
||||
href="'.$this->_globals['assets_url'].'/css/'.$stylesheet.'"
|
||||
>';
|
||||
}
|
||||
|
||||
@ -56,7 +54,7 @@ class Assets extends \Twig_Extension {
|
||||
foreach($scripts as $script) {
|
||||
$output[] = '<script
|
||||
type="text/javascript"
|
||||
src="'.$this->assets_url.'/js/'.$script.'"
|
||||
src="'.$this->_globals['assets_url'].'/js/'.$script.'"
|
||||
></script>';
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
<!-- javascripts -->
|
||||
{{ javascript(
|
||||
'mailpoet_notice.js',
|
||||
'mailpoet_modal.js'
|
||||
'notice.js',
|
||||
'modal.js',
|
||||
'handlebars/handlebars.min.js'
|
||||
)}}
|
||||
|
||||
<!-- todo: make it easier to load a dependency (loaded with Bower) -->
|
||||
<!-- <script type="text/javascript" src="{{ assets_url }}/../bower_components/handlebars/handlebars.min.js"></script> -->
|
Reference in New Issue
Block a user