Repository navigation
Closed
Description
Hi, Im trying to parse the LESS from the material-ui.com project and get the following error:
ERROR in multi main
Module not found: Error: Cannot resolve module 'www/material-ui.css' in /Users/mg/Documents/js/scaffold-web-rx
@ multi main
ERROR in ./src/material-ui.less
Module parse failed: /Users/mg/Documents/js/scaffold-web-rx/node_modules/less-loader/index.js!/Users/mg/Documents/js/scaffold-web-rx/src/material-ui.less Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| @import url('http://fonts.googleapis.com/css?family=Roboto:300,400,500');
| /*! normalize.css v3.0.2 | MIT License | git.io/normalize */
| /**
@ multi main
Heres my webpack config:
var webpack = require('webpack'),
path = require('path');
module.exports = {
entry: './src/index.jsx',
devtool: 'source-map',
output: {
path: path.join(__dirname, 'www'),
filename: 'app.js'
},
resolve: {
modulesDirectories: ['node_modules'],
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.less$/, loader: 'less' },
{ test: /\.jsx$/, loader: 'jsx-loader?harmony&insertPragma=React.DOM' },
{ test: /\.js$/, loader: '6to5-loader'},
{ test: /\.(eot|woff)$/, loader: 'file' },
]
}
};
and the materialui.
@import "~material-ui/src/less/scaffolding.less";
@import "~material-ui/src/less/components.less";
Do I need some special loader for url or is there something else going on here?
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
Add test-case for import urls
jhnns commentedon Nov 25, 2014
Seems like a bug to me, but I don't know what the problem is. @sokra it's probably because webpack passes the preprocessed css-file (which is now a js-file) to less?
I've added a test-case to demonstrate that import urls are supported.
sokra commentedon Nov 25, 2014
should be
sokra commentedon Nov 25, 2014
but the material-ui stuff is buggy in another way: webpack/css-loader#24 (comment)
mg commentedon Nov 25, 2014
Im skipping the style!css! part to try and find out what's bothering the less loader, since the faulty output from the less loader will just blow up the css loader, as per the css-loader#24 issue.
sokra commentedon Nov 25, 2014
You can try
mg commentedon Nov 25, 2014
That seems to work, thanks!
So how does it work, is the raw loader simply consuming and ignoring errors from the less loader and spewing out whatever style string it can?
sokra commentedon Nov 25, 2014
The css-loader parses the CSS for dependencies i. e.
url(...)and@import. The raw-loader just return the raw string.So you loose the image handling if you use the raw-loader instead of the css-loader...
mg commentedon Nov 25, 2014
So Im probably loosing all the fonts then?
mukeshsoni commentedon Dec 6, 2014
@mg were you able to load the fonts finally?
sokra commentedon Dec 6, 2014
As workaround you could create a loader that fixes the css:
mukeshsoni commentedon Dec 6, 2014
That works. Thanks!
But some animations are missing from the compiled code, which is expected in this case, i guess.
Also, a small typo in your post -
this.cacheable();