Da questo link:

Materialize

puoi scaricare il framework

E' molto semplice aggiungere materialize framework nella tua Yii2 App.

First way (Not suggested):

Copy all needed CSS and JS files into your public web directory. Then in your frontendassetsAppAsset class add the following lines:

<pre class="lang-php s-code-block hljs">```
<span class="hljs-keyword">public</span> <span class="hljs-variable">$css</span> = [

    <span class="hljs-comment">//... another css files</span>

    <span class="hljs-string">'css/materialize.min.css'</span>

];

<span class="hljs-keyword">public</span> <span class="hljs-variable">$js</span> = [

    <span class="hljs-comment">//... another js files</span>

    <span class="hljs-string">'js/materialize.min.js'</span>

];

Another way would be using Yii2's Bower.

Most JavaScript/CSS packages are managed using Bower and/or NPM, instead of Composer. Yii uses the Composer asset plugin to enable managing these kinds of packages through Composer. If your extension depends on a Bower package, you can simply list the dependency in composer.json like the following:

<pre class="lang-php s-code-block hljs">```
{

<span class="hljs-comment">// package dependencies</span>

<span class="hljs-string">"require"</span>: {

    <span class="hljs-string">"bower-asset/jquery"</span>: <span class="hljs-string">">=1.11.*"</span>

}

}

So:

<pre class="lang-php s-code-block hljs"> bower install materialize

More Information (Yii2's Official Document): Bower and NPM Assets

It might also be remarkable that, you can define new Asset Bundle for your app, so, there is no need to modify AppAsset class. To create your own Asset Bundle check the following links:

[Defining Asset Bundles](http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#defining-asset-bundles) and [Using Asset Bundles](http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#using-asset-bundles)**

if you want to Disable bootstrap or JQuery from your app, you can check the following link: Yii2 disable Bootstrap Js, JQuery and CSS

Come aggiungere materialize in yii2

Prossimo articolo Articolo precedente