Materialize: Meteor: How can I try new version 1.0.0-beta?

Created on 28 Mar 2018  路  19Comments  路  Source: Dogfalo/materialize

I'm using Meteor, I install by running command: meteor add materialize:materialize. Now I have a new project and want to start with 1.0.0 version of materialize. How can I do that?

Thank you.

Most helpful comment

@minhna, you need:
1 - install the npm package
meteor npm install materialize-css@next

2 - in main.js import materialize and set global (that way you don麓t need to import in every file)

import Materialize from 'materialize-css';
global.M = global.Materialize = Materialize;

3 - in mais.scss, import materialize sass

@import "{}/node_modules/materialize-css/sass/materialize.scss";

All 19 comments

Just published it to meteor, try: meteor add materialize:materialize@=1.0.0-beta

Thank you for updating the package.
After install, I've got the error:
Uncaught TypeError: Cannot set property 'Dropdown' of undefined
on line 2841 of file packages/materialize_materialize.js: window.M.Dropdown = Dropdown;

Another error in app/global-imports.js:
Uncaught TypeError: Cannot read property 'Materialize' of undefined
at line: Materialize = Package['materialize:materialize'].Materialize;

I'm using meteor 1.6.1

Potential fix for this issue added in 08bfb6942c759975616ebc23c9a80431135d60ce

How can I apply this update?

Hello, I have exactly the same issue with this new version of Materializecss like @minhna said.
How can we do to fix it please ?

For now you can clone the repo and follow this to use it as a local package: https://stackoverflow.com/questions/18328000/installing-a-local-package-on-meteor/18328769

I've already install with the repo, the problem is after, when I build the app, we have some errors.
materializecss_errors

I have the same error. Resolve it removing materialize from meteor and add the npm package unstead.

This atmosphere version is a good idea, but unfortunately it does not work properly

@Luc-cpl, how can I use that npm package from meteor?

@minhna, you need:
1 - install the npm package
meteor npm install materialize-css@next

2 - in main.js import materialize and set global (that way you don麓t need to import in every file)

import Materialize from 'materialize-css';
global.M = global.Materialize = Materialize;

3 - in mais.scss, import materialize sass

@import "{}/node_modules/materialize-css/sass/materialize.scss";

To help with inicializations, I set one folder in my project call "materialize-helpers" to set every change or js inicialization

inside that folder I set one file for js and another for html templates

for exemple, to start floating action buttons:

In helper.html

<template name="floatingActionButton">
  <div id="floatingActionButton-{{this.id}}" class="fixed-action-btn {{this.class}}">
    {{> Template.contentBlock}}
  </div>
</template>

In helper.js

Template.floatingActionButton.onRendered(function(){
  var elem = document.getElementById('floatingActionButton-' + this.data.id);
  M.FloatingActionButton.init(elem, this.data);
});

Than every time that i need to start this:

{{#floatingActionButton id='buttonID' hoverEnabled=false class="my-custom-class" ....  }} // pass the js options in here
  <a class="btn-floating btn-large red">
    <i class="large material-icons">mode_edit</i>
  </a>
  <ul>
    <li><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
    <li><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
    <li><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
    <li><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
  </ul>      
{{/floatingActionButton}}

Thank you @Luc-cpl

@Luc-cpl , I tried to import scss file
@import "{}/node_modules/materialize-css/sass/materialize.scss";
but it said:

=> Errors prevented startup:

   While processing files with fourseven:scss (for target web.browser):
   /client/main.scss: Scss compiler error: File to import:
   {}/node_modules/materialize-css/sass/materialize.scss not found in file:
   /home/minhna/WORK/OTV/choxe2/{}/client/main.scss

Please help.

I checked, the file is existing and the path is correct.

After created a file scss-config.json with following contents:

{
  "includePaths": [
    "{}/node_modules/materialize-css/sass/"
  ]
}

Now I can import in main.scss file:

@import "materialize.scss";

But now I have another error:

=> Errors prevented startup:

   While processing files with fourseven:scss (for target web.browser):
   /client/main.scss: Scss compiler error: File to import: input-fields not
   found in file: components/forms/forms

@minhna, a quick solution could be copy the path 'sass' from npm_modules to your client folder

When I import the scss I just import in main.scss and it work's on every sass that I import from npm_modules

According to the meteor documentation you only need to import into main.scss
@import '{} /node_modules/npm-package-name/button.less';

But also according to the documentation "If you are upgrading an application to Meteor 1.3 you may have to run meteor npm install --save meteor-node-stubs manually."

I don't know but it could be your case.

Source: https://guide.meteor.com/using-npm-packages.html

I installed version 1.0.0-rc.1 and update the scss-config.json with content:

{
  "includePaths": [
    "{}/node_modules/materialize-css/sass/",
    "{}/node_modules/materialize-css/sass/components/forms"
  ]
}

It works.

when using bower you are not downloading the robot source

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bradley-varol picture bradley-varol  路  3Comments

serkandurusoy picture serkandurusoy  路  3Comments

alexknipfer picture alexknipfer  路  3Comments

ericlormul picture ericlormul  路  3Comments

djensen47 picture djensen47  路  3Comments