evheniy/materialize-bundle

The MaterializeBundle adds the ability to add latest Materialize to your application.

Installs: 8 114

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 2

Open Issues: 0

Type:symfony-bundle

1.2.0 2016-06-06 11:26 UTC

This package is not auto-updated.

Last update: 2024-04-27 15:47:48 UTC


README

knpbundles.com

Latest Stable Version Total Downloads Latest Unstable Version License

Build Status Coverage Status Scrutinizer Code Quality Build Status

This bundle provides Materialize in Symfony2 from CDN cdnjs

Installation

$ composer require evheniy/materialize-bundle "1.*"

Or add to composer.json

"evheniy/materialize-bundle": "1.*"

AppKernel:

public function registerBundles()
    {
        $bundles = array(
            ...
            new Evheniy\MaterializeBundle\MaterializeBundle(),
        );
        ...

config.yml:

#MaterializeBundle
materialize: ~

or

#MaterializeBundle
materialize:
    local_js: '@AppBundle/Resources/public/js/materialize.min.js'
    local_fonts_dir: '@AppBundle/Resources/public/fonts/'
    local_css: '@AppBundle/Resources/public/css/materialize.min.css'
    local_cdn: 'cdn.domain.com'
    version: 0.97.0
    html5: true
    async: false

And Assetic Configuration in config.yml:

#Assetic Configuration
assetic:
    bundles: [ MaterializeBundle ]

Add this string to your layout (styles and js)

<html>
    <head>
    ...

    {%- include "MaterializeBundle:Materialize:css.html.twig" -%}
    </head>
    <body>
    ...

    {%- include "MaterializeBundle:Materialize:js.html.twig" -%}
    </body>
</html>

The last step

app/console assetic:dump --env=prod --no-debug

Documentation

You can change Materialize version:

materialize:
    version: 0.97.0

You can set Materialize local version (it helps if cdn doesn't work).

materialize:
    local_js: '@AppBundle/Resources/public/js/materialize.min.js'

Default value: '@MaterializeBundle/Resources/public/js/materialize.min.js'

materialize:
    local_fonts_dir: '@AppBundle/Resources/public/fonts/'

Default value: '@MaterializeBundle/Resources/public/fonts/'

materialize:
    local_css: '@AppBundle/Resources/public/css/materialize.min.css'

Default value: '@MaterializeBundle/Resources/public/css/materialize.min.css'

You can set local CDN:

materialize:
    local_cdn: 'cdn.domain.com'

You can use old html version:

materialize:
    html5: false

Default value: true. If false script will be with type="text/javascript"

You can use async loading:

materialize:
    async: true

Default value: false. If true script will be with async="async"

License

This bundle is under the MIT license.

Документация на русском языке

Materialize