skydiver/laravel-materialize-css

Add Materialize CSS Framework to Laravel

v1.0.0 2018-10-17 00:14 UTC

This package is auto-updated.

Last update: 2024-11-17 14:20:53 UTC


README

Materialize CSS Framework for Laravel 5 [http://materializecss.com/]

Installation

  • Require this package in your composer.json and run composer update.
    "skydiver/laravel-materialize-css": "dev-master"
  • After updating composer, add ServiceProvider to the providers array in config/app.php
    Skydiver\LaravelMaterializeCSS\MaterializeCSSServiceProvider::class,
  • Add Facade to the aliases array in config/app.php
	'MaterializeCSS' => Skydiver\LaravelMaterializeCSS\MaterializeCSS::class,
  • Then publish the package's assets to public folder:
    $ php artisan vendor:publish --tag=materializecss --force

Updates

You can re-publish the assets automatically when composer updated the package:

  • In your composer.json, go to scripts > post-update-cmd section, add the next line:
    "php artisan vendor:publish --tag=materializecss --force"
  • The code will look similar to:
    "post-update-cmd": [
        "php artisan optimize",
        "php artisan vendor:publish --tag=materializecss --force"
    ],

Usage

There are differents methods to include Materialize CSS assets:

  • include_full()
    {!! MaterializeCSS::include_full() !!}
    <link rel="stylesheet" charset="utf-8" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" charset="utf-8" href="http://yourdomain.com/materialize-css/css/materialize.min.css">
    <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
    <script type="text/javascript" src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script>
  • include_all()
    {!! MaterializeCSS::include_all() !!}
    <link rel="stylesheet" charset="utf-8" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" charset="utf-8" href="http://yourdomain.com/materialize-css/css/materialize.min.css">
    <script type="text/javascript" src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script>
  • include_css()
    {!! MaterializeCSS::include_css() !!}
    <link rel="stylesheet" charset="utf-8" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" charset="utf-8" href="http://yourdomain.com/materialize-css/css/materialize.min.css">
  • include_js()
    {!! MaterializeCSS::include_js() !!}
    <script src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script>
  • include_secure_css()
    {!! MaterializeCSS::include_secure_css() !!}
    <link rel="stylesheet" href="https://yourdomain.com/materialize-css/css/materialize.min.css">
  • include_secure_js()
    {!! MaterializeCSS::include_secure_js() !!}
    <script type="text/javascript" src="http://yourdomain.com/materialize-css/js/materialize.min.js"></script>
  • get_url_css($full=false, $secure=false)
    {!! MaterializeCSS::get_url_css() !!}
    {!! MaterializeCSS::get_url_css(true, false) !!}
    {!! MaterializeCSS::get_url_css(false, true) !!}
    {!! MaterializeCSS::get_url_css(true, true) !!}
    /materialize-css/css/materialize.min.css
    http://yourdomain.com/materialize-css/css/materialize.min.css
    /materialize-css/css/materialize.min.css
    https://yourdomain.com/materialize-css/css/materialize.min.css
  • get_url_js($full=false, $secure=false)
    {!! MaterializeCSS::get_url_js() !!}
    {!! MaterializeCSS::get_url_js(true, false) !!}
    {!! MaterializeCSS::get_url_js(false, true) !!}
    {!! MaterializeCSS::get_url_js(true, true) !!}
    /materialize-css/js/materialize.min.js
    http://yourdomain.com/materialize-css/js/materialize.min.js
    /materialize-css/js/materialize.min.js
    https://yourdomain.com/materialize-css/js/materialize.min.js