Skip to content

Commit 3fe36a4

Browse files
committed
* Adding Larave 5.1 support, and making it a minimum requirement since they introduced LTE.
* Removing JSQueeze support, atleast temporarily as there is a bug in the Assetic Filter with class reference.
1 parent d25eec2 commit 3fe36a4

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Laravel 5 comes with a great asset manager called Elixir. While there is nothing
88
When using Potion the you will often see is "resources" and "assets". Think of resources as the raw resources inside of Laravel resources direction. Think of assets as what Potion will generate and will ultimately be served to visitors.
99

1010
###Laravel Support
11-
At this time Potion only supports Laravel 5. While Laravel 4 support was easy to implement in code, the time needed to support requests was too much.
11+
At this time Potion only supports Laravel 5.1 or higher. While Laravel 4 support was easy to implement in code, the time needed to support requests was too much.
1212

1313
###Features
1414
- Fully integrated into Laravels' artisan commands
@@ -26,7 +26,6 @@ At this time Potion only supports Laravel 5. While Laravel 4 support was easy to
2626
- LessphpFilter
2727
- JSMinFilter
2828
- JpegoptimFilter
29-
- JSqueezeFilter
3029
- JsCompressorFilter from YUI
3130
- ScssphpFilter
3231

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@
4141
"require": {
4242
"php": ">=5.4.0",
4343
"illuminate/support": "5.*",
44-
"kriswallsmith/assetic": "1.2.1",
4544
"kriswallsmith/assetic": "1.2.1",
4645
"natxet/CssMin": "3.0.2",
4746
"leafo/lessphp": "0.5.0",
4847
"leafo/scssphp": "0.1.1",
49-
"patchwork/jsqueeze": "2.0.2",
5048
"ptachoire/cssembed": "1.0.2",
5149
"linkorb/jsmin-php": "1.0.0",
5250
"kriswallsmith/assetic": "1.2.1"

src/ClassyGeeks/Potion/Console/Command/MakeAssetsCommand.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ public function fire()
129129
// -- JS Min
130130
$filter = new JSMinFilter();
131131
$filters['js_min'] = $filter;
132-
// -- Js Squeeze
133-
$filter = new JSqueezeFilter();
134-
$filter->setSingleLine($this->config['filters']['js_squeeze']['single_line']);
135-
$filter->keepImportantComments($this->config['filters']['js_squeeze']['keep_imp_comments']);
136-
$filters['js_squeeze'] = $filter;
137132
// -- Js Yui
138133
$filter = new JsCompressorFilter($this->config['filters']['js_yui']['path_jar'], $this->config['filters']['js_yui']['path_java']);
139134
$filter->setNomunge($this->config['filters']['js_yui']['no_munge']);

src/ClassyGeeks/Potion/PotionServiceProvider.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function boot()
4646
$config_file => config_path('potion.php')
4747
], 'config');
4848

49-
// Handle blade extensions
50-
$this->bladeExtensions();
49+
// Register blade extensions
50+
$this->registerBladeExtensions();
5151

5252
}
5353

@@ -81,39 +81,39 @@ public function register()
8181
*/
8282
public function getConfig()
8383
{
84-
return $this->app['config'];
84+
return $this->app['config']['potion'];
8585
}
8686

8787
/**
88-
* Handle blade extensions
88+
* Register blade extensions
8989
*/
90-
protected function bladeExtensions()
90+
protected function registerBladeExtensions()
9191
{
9292
// Potion asset url
9393
\Blade::extend(function($view, $compiler)
9494
{
95-
$pattern = $compiler->createMatcher('potion_asset_url');
95+
$pattern = $this->createBladeMatcher('potion_asset_url');
9696
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetUrl$2); ?>', $view);
9797
});
9898

9999
// Potion Css
100100
\Blade::extend(function($view, $compiler)
101101
{
102-
$pattern = $compiler->createMatcher('potion_asset_css');
102+
$pattern = $this->createBladeMatcher('potion_asset_css');
103103
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetCss$2); ?>', $view);
104104
});
105105

106106
// Potion Js
107107
\Blade::extend(function($view, $compiler)
108108
{
109-
$pattern = $compiler->createMatcher('potion_asset_js');
109+
$pattern = $this->createBladeMatcher('potion_asset_js');
110110
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetJs$2); ?>', $view);
111111
});
112112

113113
// Potion Img
114114
\Blade::extend(function($view, $compiler)
115115
{
116-
$pattern = $compiler->createMatcher('potion_asset_img');
116+
$pattern = $this->createBladeMatcher('potion_asset_img');
117117
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetImg$2); ?>', $view);
118118
});
119119
}
@@ -128,4 +128,14 @@ public function provides()
128128
return ['potion'];
129129
}
130130

131+
/**
132+
* Create blade
133+
* @param $function
134+
* @return string
135+
*/
136+
protected function createBladeMatcher($function)
137+
{
138+
return '/(?<!\w)(\s*)@'.$function.'(\s*\(.*\))/';
139+
}
140+
131141
}

0 commit comments

Comments
 (0)