如何在webpack中使用Material Design Lite ?
How can I use Material Design Lite with webpack?
我一直在玩ReactJs,我需要在每个componentDidMount()
处理程序中调用componentHandler.upgradeDom()
。
是否有一种方法,不必调用upgradeDom
上全局定义的componentHandler
,而是使用webpack导入材料设计生活作为一个模块?
在github上有这个讨论,但是看起来库不会很快升级到导出componentHandler
。
所以我使用了webpack的exports-loader插件。我的webpack.config.js
看起来像这样:
module: {
loaders: [
{ test: /'.js$/, loader: 'jsx-loader?insertPragma=React.DOM&harmony' },
{ test: /'.js$/, loader: 'exports-loader' }
]
},
这意味着在我的模块中我现在可以调用
var ch = require('exports?componentHandler!material-design-lite/material.js');
ch.upgradeDom();
相关文章:
- Backbone.js restful json API design
- Material Design Lite所有元素加载JS回调
- JavaScript 切换 Material Design Lite 开关
- Material Design Lite菜单动态重复
- Angular JS(尤其是 Angular Material Design)在 Sublime Text 3 上不能很
- Material Design Lite 不能完全与 Angular2 配合使用
- 在 AngularJS Material Design 中,如何在“md-toolbar”中隐藏溢出的文本
- Angular2 with Material Design Lite
- 使用 React 递增 Material Design Lite 进度条
- AngularJS Material Design代码可在Chrome中使用,但不能在Firefox中使用
- Material Design Lite JS未应用于动态加载的html文件
- Material Design Lite固定导航行
- 如何在Google Material Design Lite中添加2个滑动菜单
- 使用Material Design Lite复选框高亮显示整个表格行
- Material Design Lite表格-添加行动态打断格式
- Material Design Lite和jQuery,平滑滚动有些问题
- 在AngularJS中使用Material Design Lite
- 如何在Material Design Lite中使用class而不是ID
- 如何在webpack中使用Material Design Lite ?
- Material Design life与AngularJS的集成