├── .gitignore
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src
├── ClassyGeeks
│ └── Potion
│ │ ├── BladeHelpers.php
│ │ ├── Console
│ │ └── Command
│ │ │ ├── ClearAssetsCommand.php
│ │ │ └── MakeAssetsCommand.php
│ │ └── PotionServiceProvider.php
└── config
│ └── config.php
└── tests
└── .gitkeep
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS generated files
2 | .DS_Store
3 | .DS_Store?
4 | ._*
5 | .Spotlight-V100
6 | .Trashes
7 | Icon?
8 | ehthumbs.db
9 | Thumbs.db
10 | sftp-*
11 | __MACOSX
12 |
13 | # Ide's
14 | /.idea
15 | /*.iml
16 |
17 | # Gem lock
18 | /Gemfile.lock
19 |
20 | # Composer
21 | /composer.phar
22 | /composer.lock
23 | /vendor
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Classy Geeks llc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # laravel-potion
2 |
3 | Potion is a pure PHP asset manager for Laravel based off of [Assetic](https://github.com/kriswallsmith/assetic).
4 |
5 | # Description
6 | Laravel 5 comes with a great asset manager called Elixir. While there is nothing wrong with Elixir, it requires you to install Node.js, Gulp, and dependent NPM packages on all of your web serves. While there is nothing wrong with this if you have other needs for those technologies, it seemed unnecessary to us to install that stack solely for the sake of handling assets. So we wrote Potion. Potion is a pure PHP solution, based off of [Assetic](https://github.com/kriswallsmith/assetic) that allows you to handle your assets in the same technology stack that your application is written in.
7 |
8 | 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.
9 |
10 | # Laravel Support
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.
12 |
13 | # Features
14 | - Fully integrated into Laravels' artisan commands
15 | - Asset versioning support
16 | - Asset CDN Url support
17 | - Blade Helpers for Asset inclusion in templates
18 | - Command to clear all assets already published on disk
19 | - Makes use of Cache configuration, and not disk, in order to account for load balanced servers.
20 | - Supports the following filters from Assetic:
21 | - OptiPngFilter
22 | - CssImportFilter
23 | - CssRewriteFilter
24 | - CssMinFilter
25 | - CssCompressorFilter from YUI
26 | - LessphpFilter
27 | - JSMinFilter
28 | - JpegoptimFilter
29 | - JsCompressorFilter from YUI
30 | - ScssphpFilter
31 |
32 | # Installation
33 | 1) Add 'classygeeks/potion' package to your composer.json file:
34 |
35 | 2) Add the Potion Service provider to your config/app.php file under the predefined "providers" array:
36 | ```php
37 | 'providers' => [
38 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider',
39 | ...
40 | 'ClassyGeeks\Potion\PotionServiceProvider'
41 | ...
42 | ],
43 | ```
44 |
45 | 3) Publish the config file
46 | ```php
47 | php artisan vendor:publish
48 | ```
49 |
50 | You will now see to new Potion artisan commands. The configuration is very well documented and should be able to get even the most complex projects going quickly.
51 |
52 | # Future Features
53 | - Resource watching command functionality
54 | - Support for more filters from Assetic
55 |
56 | # Rules For Contributing
57 | - Please make sure all changed files are run through gofmt
58 | - Submit a PR for review
59 | - Your name will be added below to Contributors
60 |
61 | # Author
62 | [Matthew R. Miller](https://github.com/mattrmiller)
63 |
64 | # Contributors
65 | [Matthew R. Miller](https://github.com/mattrmiller)
66 |
67 | # License
68 | [MIT License](LICENSE)
69 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "classygeeks/potion",
3 | "description": "Potion is a pure PHP asset manager for Laravel based off of Assetic.",
4 | "license": "MIT",
5 | "authors": [
6 | {
7 | "name": "Classy Geeks llc.",
8 | "email": "support@classygeeks.com",
9 | "homepage": "http://classygeeks.com"
10 | }
11 | ],
12 | "keywords": [
13 | "assets",
14 | "asset-processing",
15 | "asset-management",
16 | "less",
17 | "sass",
18 | "scss",
19 | "minifying",
20 | "minify",
21 | "laravel",
22 | "compass",
23 | "cssmin",
24 | "jsmin"
25 | ],
26 | "tags": [
27 | "assets",
28 | "asset-processing",
29 | "asset-management",
30 | "less",
31 | "sass",
32 | "scss",
33 | "minifying",
34 | "minify",
35 | "laravel",
36 | "compass",
37 | "cssmin",
38 | "jsmin"
39 |
40 | ],
41 | "require": {
42 | "php": ">=5.4.0",
43 | "illuminate/support": "5.*",
44 | "kriswallsmith/assetic": "1.*",
45 | "natxet/CssMin": "3.0.*",
46 | "leafo/lessphp": "0.5.*",
47 | "leafo/scssphp": "0.6.*",
48 | "ptachoire/cssembed": "1.0.*",
49 | "linkorb/jsmin-php": "1.0.*"
50 | },
51 | "autoload": {
52 | "psr-0": {
53 | "ClassyGeeks\\Potion\\": [
54 | "src/"
55 | ]
56 | }
57 | },
58 | "minimum-stability": "dev"
59 | }
60 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 | ./tests/
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/ClassyGeeks/Potion/BladeHelpers.php:
--------------------------------------------------------------------------------
1 | ";
81 | }
82 |
83 | /**
84 | * Asset Js
85 | * @param $name
86 | * @param $version
87 | * @return bool|string
88 | */
89 | public static function assetJs($name, $version = false)
90 | {
91 | // Get cache
92 | $cache = Cache::get('potion_assets', []);
93 |
94 | // Check for asset
95 | if (!isset($cache[$name])) {
96 | return false;
97 | }
98 |
99 | // Url
100 | $url = self::assetUrl($name, $version);
101 |
102 | // Return
103 | return "";
104 | }
105 |
106 | /**
107 | * Asset Img
108 | * @param $name
109 | * @param $version
110 | * @return bool|string
111 | */
112 | public static function assetImg($name, $version = false)
113 | {
114 | // Get cache
115 | $cache = Cache::get('potion_assets', []);
116 |
117 | // Check for asset
118 | if (!isset($cache[$name])) {
119 | return false;
120 | }
121 |
122 | // Url
123 | $url = self::assetUrl($name, $version);
124 |
125 | // Return
126 | return "
";
127 | }
128 | }
--------------------------------------------------------------------------------
/src/ClassyGeeks/Potion/Console/Command/ClearAssetsCommand.php:
--------------------------------------------------------------------------------
1 | config = $config;
56 | }
57 |
58 | /**
59 | * Execute the console command.
60 | *
61 | * @return mixed
62 | */
63 | public function fire()
64 | {
65 | try {
66 |
67 | // Potion config
68 | if ($this->config === false) {
69 | throw new \Exception('Invalid potion config, please run "artisan vendor:publish" in your project root to public the potion config file.');
70 | }
71 |
72 | // Clean up paths
73 | $this->config['assets_path'] = rtrim($this->config['assets_path'], '/');
74 | $this->config['assets_path'] = rtrim($this->config['assets_path'], '\\');
75 |
76 | // Make sure assets direction exists
77 | if (!is_dir($this->config['assets_path'])) {
78 | throw new \Exception("Invalid assets folder: {$this->config['assets_path']}");
79 | }
80 |
81 | // Confirm that the user wants to clear
82 | $force = $this->input->getOption('force');
83 | if (empty($force)) {
84 | $this->info("This will clear all assets in: {$this->config['assets_path']}");
85 | $confirmed = $this->confirm('Do you really wish to run this command? [y/N]');
86 | if (!$confirmed) {
87 | $this->comment('Command Cancelled!');
88 | return false;
89 | }
90 | }
91 |
92 | // Delete all files, do not delete recursively as that is dangerous
93 | $files = glob($this->config['assets_path'] . DIRECTORY_SEPARATOR . '*');
94 | foreach ($files as $file) {
95 |
96 | // -- Sanity check
97 | if (is_file($file)) {
98 |
99 | // -- -- Echo
100 | $this->info("Deleting assets: {$file}");
101 |
102 | // -- -- Delete
103 | unlink($file);
104 | }
105 | }
106 |
107 | // Clear cache
108 | Cache::forget('potion_assets');
109 |
110 | }
111 | catch (\Exception $e) {
112 |
113 | // Echo
114 | $this->error($e->getMessage());
115 |
116 | }
117 | }
118 |
119 | /**
120 | * Get the console command arguments.
121 | *
122 | * @return array
123 | */
124 | protected function getArguments()
125 | {
126 | return [];
127 | }
128 |
129 | /**
130 | * Get the console command options.
131 | *
132 | * @return array
133 | */
134 | protected function getOptions()
135 | {
136 | return [
137 | ['force', null, InputOption::VALUE_NONE, 'Force the operation.'],
138 | ];
139 | }
140 | }
--------------------------------------------------------------------------------
/src/ClassyGeeks/Potion/Console/Command/MakeAssetsCommand.php:
--------------------------------------------------------------------------------
1 | config = $config;
67 | }
68 |
69 | /**
70 | * Execute the console command.
71 | *
72 | * @return mixed
73 | */
74 | public function fire()
75 | {
76 | try {
77 |
78 | // Potion config
79 | if ($this->config === false) {
80 | throw new \Exception('Invalid potion configuration, please run "artisan vendor:publish" in your project root to public the potion config file.');
81 | }
82 |
83 | // Clean up paths
84 | $this->config['resource_path'] = rtrim($this->config['resource_path'], '/');
85 | $this->config['resource_path'] = rtrim($this->config['resource_path'], '\\');
86 | $this->config['assets_path'] = rtrim($this->config['assets_path'], '/');
87 | $this->config['assets_path'] = rtrim($this->config['assets_path'], '\\');
88 |
89 | // Log
90 | $this->info('Making assets using:');
91 | $this->info("\tResource Path: {$this->config['resource_path']}");
92 | $this->info("\tAsset Path: {$this->config['assets_path']}");
93 |
94 | // Make the assets path
95 | if (!$this->makePath($this->config['assets_path'])) {
96 | throw new \Exception("Unable to make assets_path from config: {$this->config['assets_path']}");
97 | }
98 |
99 | // Filters
100 | $filters = [];
101 | // -- optipng
102 | $filter = new OptiPngFilter($this->config['filters']['optipng']['path']);
103 | $filter->setLevel($this->config['filters']['optipng']['level']);
104 | $filters['optipng'] = $filter;
105 | // -- jpegoptim
106 | $filter = new JpegoptimFilter($this->config['filters']['jpegoptim']['path']);
107 | $filter->setStripAll($this->config['filters']['jpegoptim']['strip']);
108 | $filter->setMax($this->config['filters']['jpegoptim']['max']);
109 | $filters['jpegoptim'] = $filter;
110 | // -- Css import
111 | $filter = new CssImportFilter();
112 | $filters['css_import'] = $filter;
113 | // -- Css rewrite
114 | $filter = new CssRewriteFilter();
115 | $filters['css_rewrite'] = $filter;
116 | // -- Css min
117 | $filter = new CssMinFilter();
118 | $filters['css_min'] = $filter;
119 | // -- Css Yui
120 | $filter = new CssCompressorFilter($this->config['filters']['css_yui']['path_jar'], $this->config['filters']['css_yui']['path_java']);
121 | $filters['css_yui'] = $filter;
122 | // -- CSS LessPHP
123 | $filter = new LessphpFilter();
124 | $filter->setLoadPaths($this->config['filters']['css_lessphp']['path_imports']);
125 | $filter->setFormatter($this->config['filters']['css_lessphp']['format']);
126 | $filter->setPreserveComments($this->config['filters']['css_lessphp']['preserve_comments']);
127 | $filters['css_lessphp'] = $filter;
128 | // -- CSS ScssPHP
129 | $filter = new ScssphpFilter();
130 | $filter->setImportPaths($this->config['filters']['css_scssphp']['path_imports']);
131 | $filter->setFormatter($this->config['filters']['css_scssphp']['format']);
132 | $filters['css_scssphp'] = $filter;
133 | // -- JS Min
134 | $filter = new JSMinFilter();
135 | $filters['js_min'] = $filter;
136 | // -- Js Yui
137 | $filter = new JsCompressorFilter($this->config['filters']['js_yui']['path_jar'], $this->config['filters']['js_yui']['path_java']);
138 | $filter->setNomunge($this->config['filters']['js_yui']['no_munge']);
139 | $filter->setPreserveSemi($this->config['filters']['js_yui']['preserve_semi']);
140 | $filter->setDisableOptimizations($this->config['filters']['js_yui']['disable_opti']);
141 | $filters['js_yui'] = $filter;
142 |
143 | // Cache
144 | $cache = [];
145 |
146 | // Each potion
147 | foreach ($this->config['potions'] as $potion) {
148 |
149 | // -- Find assets
150 | $resource_filters = [];
151 | foreach ($potion['filters'] as $filter) {
152 | $resource_filters[] = $filters[$filter];
153 | }
154 |
155 | // -- Asset content
156 | $asset_content = '';
157 |
158 | // -- Resources
159 | foreach ($potion['resources'] as $resource) {
160 |
161 | // -- -- Make full path
162 | $resource = ltrim($resource, '/');
163 | $resource = ltrim($resource, '\\');
164 | $asset_path = $this->config['resource_path'] . DIRECTORY_SEPARATOR . $resource;
165 |
166 | // -- -- Echo
167 | $this->info("Processing resource: {$asset_path}");
168 |
169 | // -- -- Get path info
170 | $pathinfo = pathinfo($asset_path);
171 |
172 | // -- -- File assets
173 | $file_assets = [];
174 |
175 | // -- -- Glob?
176 | if ($pathinfo['extension'] == '*' || $pathinfo['filename'] == '*') {
177 |
178 | // -- -- -- Get all file assets
179 | $glob = new GlobAsset($asset_path, $resource_filters);
180 | foreach ($glob->all() as $file_asset) {
181 | $file_assets[] = new FileAsset(rtrim($file_asset->getSourceRoot(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file_asset->getSourcePath(), $resource_filters);
182 | }
183 | }
184 | else {
185 | $file_assets[] = new FileAsset($asset_path, $resource_filters);
186 | }
187 |
188 | // -- -- Each file asset
189 | foreach ($file_assets as $file_asset) {
190 |
191 | // -- -- -- File
192 | $file_path = $this->config['assets_path'] . DIRECTORY_SEPARATOR . $file_asset->getSourcePath();
193 |
194 | // -- -- -- Echo
195 | $this->info("Processing resource file: {$file_path}");
196 |
197 | // -- -- -- Make file, or combine
198 | if ($potion['output'] !== false) {
199 | $asset_content .= $file_asset->dump();
200 | }
201 | else {
202 |
203 | // -- -- -- -- Echo
204 | $this->info("Writing asset file: {$file_path}");
205 |
206 | // -- -- -- -- Write
207 | if (file_put_contents($file_path, $file_asset->dump()) === false) {
208 | $this->error("Error writing asset file: {$file_path}");
209 | }
210 |
211 | // -- -- -- -- Add to cache
212 | $cache[$file_asset->getSourcePath()] = $this->versionFile($file_path);
213 | }
214 | }
215 | }
216 |
217 | // -- Combine to a single file
218 | if ($potion['output'] !== false) {
219 |
220 | // -- -- Write to file
221 | $file_path = $this->config['assets_path'] . DIRECTORY_SEPARATOR . $potion['output'];
222 |
223 | // -- -- Echo
224 | $this->info("Writing asset file: {$file_path}");
225 |
226 | // -- -- Write
227 | if (file_put_contents($file_path, $asset_content) === false) {
228 | $this->error("Error writing asset file: {$file_path}");
229 | }
230 |
231 | // -- -- Add to cache
232 | $cache[$potion['output']] = $this->versionFile($file_path);
233 | }
234 | }
235 |
236 | // Set cache
237 | Cache::forever('potion_assets', $cache);
238 |
239 | }
240 | catch (\Exception $e) {
241 |
242 | // Echo
243 | $this->error($e->getMessage());
244 |
245 | }
246 | }
247 |
248 | /**
249 | * Version file
250 | * @param $file_path
251 | * @return string
252 | */
253 | protected function versionFile($file_path)
254 | {
255 | return sha1_file($file_path);
256 | }
257 |
258 | /**
259 | * Make path
260 | *
261 | * @param $path
262 | * @return bool
263 | */
264 | protected function makePath($path)
265 | {
266 | // Log
267 | $this->info("Attempting to make path: {$path}");
268 |
269 | // Make
270 | if (!is_dir($path)) {
271 | if (mkdir($path) === false) {
272 | $this->error("Error in making path: {$path}");
273 | return false;
274 | }
275 | }
276 |
277 | // Make writable
278 | if (!is_writable($path)) {
279 | if (chmod($path, 0777) === false) {
280 | $this->error("Error in making path writable: {$path}");
281 | return false;
282 | }
283 | }
284 |
285 | return true;
286 | }
287 |
288 | /**
289 | * Get the console command arguments.
290 | *
291 | * @return array
292 | */
293 | protected function getArguments()
294 | {
295 | return [];
296 | }
297 |
298 | /**
299 | * Get the console command options.
300 | *
301 | * @return array
302 | */
303 | protected function getOptions()
304 | {
305 | return [];
306 | }
307 | }
--------------------------------------------------------------------------------
/src/ClassyGeeks/Potion/PotionServiceProvider.php:
--------------------------------------------------------------------------------
1 | mergeConfigFrom($config_file, 'potion');
44 | // -- -- Tell laravel that we publish this file
45 | $this->publishes([
46 | $config_file => config_path('potion.php')
47 | ], 'config');
48 |
49 | // Register blade extensions
50 | $this->registerBladeExtensions();
51 |
52 | }
53 |
54 | /**
55 | * Register the service provider.
56 | *
57 | * @return void
58 | */
59 | public function register()
60 | {
61 | // Make assets command
62 | $this->app->bind('potion.make-assets', function() {
63 | return new MakeAssetsCommand($this->getConfig());
64 | });
65 |
66 | // Clear assets command
67 | $this->app->singleton('potion.clear-assets', function() {
68 | return new ClearAssetsCommand($this->getConfig());
69 | });
70 |
71 | // Register commands
72 | $this->commands([
73 | 'potion.make-assets',
74 | 'potion.clear-assets'
75 | ]);
76 | }
77 |
78 | /**
79 | * Get config
80 | * @return array
81 | */
82 | public function getConfig()
83 | {
84 | return $this->app['config']['potion'];
85 | }
86 |
87 | /**
88 | * Register blade extensions
89 | */
90 | protected function registerBladeExtensions()
91 | {
92 | // Potion asset url
93 | \Blade::extend(function($view, $compiler)
94 | {
95 | $pattern = $this->createBladeMatcher('potion_asset_url');
96 | return preg_replace($pattern, '$1', $view);
97 | });
98 |
99 | // Potion Css
100 | \Blade::extend(function($view, $compiler)
101 | {
102 | $pattern = $this->createBladeMatcher('potion_asset_css');
103 | return preg_replace($pattern, '$1', $view);
104 | });
105 |
106 | // Potion Js
107 | \Blade::extend(function($view, $compiler)
108 | {
109 | $pattern = $this->createBladeMatcher('potion_asset_js');
110 | return preg_replace($pattern, '$1', $view);
111 | });
112 |
113 | // Potion Img
114 | \Blade::extend(function($view, $compiler)
115 | {
116 | $pattern = $this->createBladeMatcher('potion_asset_img');
117 | return preg_replace($pattern, '$1', $view);
118 | });
119 | }
120 |
121 | /**
122 | * Get the services provided by the provider.
123 | *
124 | * @return array
125 | */
126 | public function provides()
127 | {
128 | return ['potion'];
129 | }
130 |
131 | /**
132 | * Create blade
133 | * @param $function
134 | * @return string
135 | */
136 | protected function createBladeMatcher($function)
137 | {
138 | return '/(? base_path('resources/assets'),
18 |
19 | // Assets root path, used as the base path, for all published assets
20 | 'assets_path' => public_path('assets'),
21 |
22 | // Base url for referencing potion assets in blade templates
23 | 'base_url' => '/assets',
24 |
25 | // Potions
26 | 'potions' => [
27 |
28 | [
29 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
30 | 'resources' => [
31 | '/css/*.css',
32 | '/css/*.scss'
33 | ],
34 |
35 | // Filters to use, from filters below
36 | 'filters' => [
37 | 'css_import',
38 | 'css_rewrite',
39 | 'css_min',
40 | 'css_yui'
41 | ],
42 |
43 | // Output file name, this signifies you are combining all resources together,
44 | // putting false will generate each file with original file names
45 | 'output' => 'app.css'
46 | ],
47 |
48 | [
49 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
50 | 'resources' => [
51 | '/js/global/*.js'
52 | ],
53 |
54 | // Filters to use, from filters below
55 | 'filters' => [
56 | 'js_squeeze'
57 | ],
58 |
59 | // Output file name, this signifies you are combining all resources together,
60 | // putting false will generate each file with original file names
61 | 'output' => 'app.js'
62 | ],
63 |
64 | [
65 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
66 | 'resources' => [
67 | '/js/pages/*.js'
68 | ],
69 |
70 | // Filters to use, from filters below
71 | 'filters' => [
72 | 'js_squeeze'
73 | ],
74 |
75 | // Output file name, this signifies you are combining all resources together,
76 | // putting false will generate each file with original file names
77 | 'output' => false
78 | ],
79 |
80 | [
81 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
82 | 'resources' => [
83 | '/img/*.jpeg',
84 | '/img/*.jpg'
85 | ],
86 |
87 | // Filters to use, from filters below
88 | 'filters' => [
89 | 'jpegoptim'
90 | ],
91 |
92 | // Output file name, this signifies you are combining all resources together, putting false will generate each file with original file names
93 | 'output' => false
94 | ],
95 |
96 | [
97 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
98 | 'resources' => [
99 | '/img/*.png'
100 | ],
101 |
102 | // Filters to use, from filters below
103 | 'filters' => [
104 | 'optipng'
105 | ],
106 |
107 | // Output file name, this signifies you are combining all resources together, putting false will generate each file with original file names
108 | 'output' => false
109 | ],
110 |
111 | [
112 | // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
113 | 'resources' => [
114 | '/img/*.ico'
115 | ],
116 |
117 | // Filters to use, from filters below
118 | 'filters' => [
119 | ],
120 |
121 | // Output file name, this signifies you are combining all resources together, putting false will generate each file with original file names
122 | 'output' => false
123 | ]
124 |
125 | ],
126 |
127 | // Filters
128 | 'filters' => [
129 |
130 | // JS Min settings
131 | 'js_min' => [
132 |
133 | ],
134 |
135 | // JS Squeeze settings
136 | 'js_squeeze' => [
137 |
138 | // Single line
139 | 'single_line' => true,
140 |
141 | // Keep important comments
142 | 'keep_imp_comments' => false
143 |
144 | ],
145 |
146 | // Yui JS compressor settings
147 | 'js_yui' => [
148 |
149 | // Path to yui jar
150 | 'path_jar' => '/usr/share/yui-compressor/yui-compressor.jar',
151 |
152 | // Path to java binary
153 | 'path_java' => '/usr/bin/java',
154 |
155 | // No munge
156 | 'no_munge' => false,
157 |
158 | // Preserve semi
159 | 'preserve_semi' => true,
160 |
161 | // Disable optimizations
162 | 'disable_opti' => true
163 |
164 | ],
165 |
166 | // Css Import settings
167 | 'css_import' => [
168 |
169 | ],
170 |
171 | // CSS Rewrite settings
172 | 'css_rewrite' => [
173 |
174 | ],
175 |
176 | // Css Min settings
177 | 'css_min' => [
178 |
179 | ],
180 |
181 | // Yui CSS compressor settings
182 | 'css_yui' => [
183 |
184 | // Path to yui jar
185 | 'path_jar' => '/usr/share/yui-compressor/yui-compressor.jar',
186 |
187 | // Path to java binary
188 | 'path_java' => '/usr/bin/java'
189 |
190 | ],
191 |
192 | // LessPhp settings
193 | 'css_lessphp' => [
194 |
195 | // Import paths
196 | 'path_imports' => [
197 | base_path('resources/assets/css')
198 | ],
199 |
200 | // Format ('', lessjs, compressed, classic)
201 | 'format' => '',
202 |
203 | // Preserve comments
204 | 'preserve_comments' => false
205 |
206 | ],
207 |
208 | // ScssPhp settings
209 | 'css_scssphp' => [
210 |
211 | // Import paths
212 | 'path_imports' => [
213 | base_path('resources/assets/css')
214 | ],
215 |
216 | // Format (scss_formatter, scss_formatter_nested, scss_formatter_compressed)
217 | 'format' => 'scss_formatter_nested',
218 |
219 | ],
220 |
221 | // OptiPng settings, requires being installed on your server, will be used for (PNG, BMP, GIF, PNM or TIFF)
222 | 'optipng' => [
223 |
224 | // Path to optipng binary
225 | 'path' => '/usr/bin/optipng',
226 |
227 | // Level (0-7) (7 is highest)
228 | 'level' => 2
229 |
230 | ],
231 |
232 | // JpegOptim settings, requires being installed on your server, will be used for (JPG, JPEG)
233 | 'jpegoptim' => [
234 |
235 | // Path to jpegoptim binary
236 | 'path' => '/usr/bin/jpegoptim',
237 |
238 | // Strip comment & exif markers
239 | 'strip' => true,
240 |
241 | // Maximum image quality factor
242 | 'max' => 80
243 |
244 | ]
245 |
246 | ]
247 |
248 | ];
--------------------------------------------------------------------------------
/tests/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattrmiller/laravel-potion/a57fe22679b9148fb58f67d6b34588225467e357/tests/.gitkeep
--------------------------------------------------------------------------------