|
| 1 | +# laravel-materialize-css |
| 2 | +Materialize CSS Framework for Laravel 5 [http://materializecss.com/] |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +* Require this package in your composer.json and run composer update. |
| 9 | +``` |
| 10 | + "mskydiver/laravel-materialize-css": "dev-master" |
| 11 | +``` |
| 12 | + |
| 13 | +* After updating composer, add the ServiceProvider to the providers array in config/app.php |
| 14 | +```php |
| 15 | + 'Skydiver\LaravelMaterializeCSS\MaterializeCSSServiceProvider', |
| 16 | +``` |
| 17 | + |
| 18 | +* Then publish the package's assets to public folder: |
| 19 | +``` |
| 20 | + $ php artisan vendor:publish --tag=materializecss --force |
| 21 | +``` |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## Updates |
| 26 | +You can re-publish the assets automatically when composer updated the package: |
| 27 | + |
| 28 | +* In your composer.json, go to **scripts** > **post-update-cmd** section, add the next line: |
| 29 | +``` |
| 30 | + "php artisan vendor:publish --tag=materializecss --force" |
| 31 | +``` |
| 32 | + |
| 33 | +* The code will look similar to: |
| 34 | +``` |
| 35 | + "post-update-cmd": [ |
| 36 | + "php artisan optimize", |
| 37 | + "php artisan vendor:publish --tag=materializecss --force" |
| 38 | + ], |
| 39 | +``` |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +There are differents methods to include Materialize CSS assets: |
| 46 | + |
| 47 | +* **include_full()** |
| 48 | +```php |
| 49 | + {!! MaterializeCSS::include_full() !!} |
| 50 | +``` |
| 51 | +```html |
| 52 | + <link rel="stylesheet" href="http://yourdomain.com/materialize-css/css/materialize.min.css"> |
| 53 | + <script src="//code.jquery.com/jquery-2.1.1.min.js"></script> |
| 54 | + <script src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script> |
| 55 | +``` |
| 56 | + |
| 57 | +* **include_all()** |
| 58 | +```php |
| 59 | + {!! MaterializeCSS::include_all() !!} |
| 60 | +``` |
| 61 | +```html |
| 62 | + <link rel="stylesheet" href="http://yourdomain.com/materialize-css/css/materialize.min.css"> |
| 63 | + <script src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script> |
| 64 | +``` |
| 65 | + |
| 66 | +* **include_css()** |
| 67 | +```php |
| 68 | + {!! MaterializeCSS::include_css() !!} |
| 69 | +``` |
| 70 | +```html |
| 71 | + <link rel="stylesheet" href="http://yourdomain.com/materialize-css/css/materialize.min.css"> |
| 72 | +``` |
| 73 | + |
| 74 | +* **include_js()** |
| 75 | +```php |
| 76 | + {!! MaterializeCSS::include_js() !!} |
| 77 | +``` |
| 78 | +```html |
| 79 | + <script src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script> |
| 80 | +``` |
| 81 | + |
| 82 | +* **include_secure_css()** |
| 83 | +```php |
| 84 | + {!! MaterializeCSS::include_secure_css() !!} |
| 85 | +``` |
| 86 | +```html |
| 87 | + <link rel="stylesheet" href="https://yourdomain.com/materialize-css/css/materialize.min.css"> |
| 88 | +``` |
| 89 | + |
| 90 | +* **include_secure_js()** |
| 91 | +```php |
| 92 | + {!! MaterializeCSS::include_secure_js() !!} |
| 93 | +``` |
| 94 | +```html |
| 95 | + <script src="https://yourdomain.com/materialize-css/js/materialize.min.js"></script> |
| 96 | +``` |
| 97 | + |
| 98 | +* **get_url_css($full=false, $secure=false)** |
| 99 | +```php |
| 100 | + {!! MaterializeCSS::get_url_css() !!} |
| 101 | + {!! MaterializeCSS::get_url_css(true, false) !!} |
| 102 | + {!! MaterializeCSS::get_url_css(false, true) !!} |
| 103 | + {!! MaterializeCSS::get_url_css(true, true) !!} |
| 104 | +``` |
| 105 | +```html |
| 106 | + /materialize-css/css/materialize.min.css |
| 107 | + http://yourdomain.com/materialize-css/css/materialize.min.css |
| 108 | + /materialize-css/css/materialize.min.css |
| 109 | + https://yourdomain.com/materialize-css/css/materialize.min.css |
| 110 | +``` |
| 111 | + |
| 112 | +* **get_url_js($full=false, $secure=false)** |
| 113 | +```php |
| 114 | + {!! MaterializeCSS::get_url_js() !!} |
| 115 | + {!! MaterializeCSS::get_url_js(true, false) !!} |
| 116 | + {!! MaterializeCSS::get_url_js(false, true) !!} |
| 117 | + {!! MaterializeCSS::get_url_js(true, true) !!} |
| 118 | +``` |
| 119 | +```html |
| 120 | + /materialize-css/js/materialize.min.js |
| 121 | + http://yourdomain.com/materialize-css/js/materialize.min.js |
| 122 | + /materialize-css/js/materialize.min.js |
| 123 | + https://yourdomain.com/materialize-css/js/materialize.min.js |
| 124 | +``` |
0 commit comments