pl12133 / css-object-loader Goto Github PK
View Code? Open in Web Editor NEWWebpack loader to load CSS into a camelCased object
Webpack loader to load CSS into a camelCased object
Users of css-loader
have become accustomed to having url('...')
statements processed by url-loader
and file-loader
. This loader should emit fonts and images in the same exact way that css-loader
does.
I have had no luck on finding documentation on the topic of a loader requiring other files in the way css-loader
does. It seems that css-loader
injects a runtime to require
all the assets from url()
statements, but I have yet to find a viable solution.
I've tried with both css-loader and postcss-loader; my Webpack config is as follows:
module:{
rules: [
{
test: /\.(css)$/,
loaders: ["css-object-loader", "postcss-loader", "css-loader"],
exclude: /node_modules/,
}
]
}
Error as follows:
ERROR in ./source/styles/menu.css
Module build failed: Syntax Error
(1:1) Unknown word
> 1 | exports = module.exports = require("../../node_modules/css-loader/lib/css-base.js")(undefined);
| ^
2 | // imports
3 |
If I take out postcss-loader so css-loader is piping straight into css-object-loader, I get this:
ERROR in ./source/styles/menu.css
Module build failed: Error: undefined:6:45: property missing ':'
at error (D:\projects\downright\node_modules\css\lib\parse\index.js:62:15)
at declaration (D:\projects\downright\node_modules\css\lib\parse\index.js:223:33)
at declarations (D:\projects\downright\node_modules\css\lib\parse\index.js:252:19)
at rule (D:\projects\downright\node_modules\css\lib\parse\index.js:560:21)
at rules (D:\projects\downright\node_modules\css\lib\parse\index.js:117:70)
at stylesheet (D:\projects\downright\node_modules\css\lib\parse\index.js:81:21)
at Object.module.exports [as parse] (D:\projects\downright\node_modules\css\lib\parse\index.js:564:20)
at getParsedStylesheet (D:\projects\downright\node_modules\css-object-loader\src\index.js:22:14)
at Object.cssObjectLoader (D:\projects\downright\node_modules\css-object-loader\src\index.js:14:26)
@ ./source/OuterContainer.jsx 7:0-39
@ ./source/ContextMenuProvider.jsx
@ ./source/index.js
@ multi ./source/index.js
I assume this is because of Webpack 2?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.