webpack-style-loader

webpack css-loader not finding images within url() reference in an external stylesheet

て烟熏妆下的殇ゞ 提交于 2019-11-28 18:32:38
I'm new to the whole Node/NPM/Webpack world, so apologies if this is obvious. I'm attempting to build a simple front-end project bundled with Webpack. I've got node installed, and have a package.json file configured. If I run "npm start" in my root directory, I get no errors from the console, and I'm able to go to "localhost:3000" in a browser and see my "hello, world" output. My next task is to include a stylesheet, which contains a reference to an image, like this: .myimg {background: url(path/to/file.jpg);} With things set up like this, I can view the image via the webpack-dev-server (by

webpack css-loader not finding images within url() reference in an external stylesheet

大城市里の小女人 提交于 2019-11-27 11:52:44
问题 I'm new to the whole Node/NPM/Webpack world, so apologies if this is obvious. I'm attempting to build a simple front-end project bundled with Webpack. I've got node installed, and have a package.json file configured. If I run "npm start" in my root directory, I get no errors from the console, and I'm able to go to "localhost:3000" in a browser and see my "hello, world" output. My next task is to include a stylesheet, which contains a reference to an image, like this: .myimg {background: url

Example of how to load static CSS files from node_modules using webpack?

橙三吉。 提交于 2019-11-27 09:13:55
I don't know how to load with webpack any CSS from node_modules libs, for example I've installed leaflet and each attempt of load leaflet/dist/leaflet.css fails. Could you provide example how to load static styles from node_modules? My current webpack config below. Additionaly I'm using extract-text-webpack-plugin and sass-loader my project scss files are working well, I have also css-loader , have I to resolve static css files or add something to stylePathResolves ? //require('leaflet/dist/leaflet.css'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); var webpack = require(

Webpack style-loader vs css-loader

拜拜、爱过 提交于 2019-11-27 05:51:13
I have two questions. 1) CSS Loader and Style Loader are two webpack loaders. I couldn't grasp the difference between the two. Why do I have to use two loaders when they both do the same job? 2) What is this .useable.less and .useable.css mentioned in the above Readme.md files? The CSS loader takes a CSS file and returns the CSS with imports and url(...) resolved via webpack's require functionality: var css = require("css!./file.css"); // => returns css code from file.css, resolves imports and url(...) It doesn't actually do anything with the returned CSS. The style loader takes CSS and

Webpack “OTS parsing error” loading fonts

故事扮演 提交于 2019-11-26 23:58:12
My webpack config specifies that fonts should be loaded using url-loader , and when I try to view the page using Chrome I get the following error: OTS parsing error: invalid version tag Failed to decode downloaded font: [My local URL] The relevant parts of my config look like this: { module: { loaders: [ // ... { test: /\.scss$/, loaders: ['style', 'css?sourceMap', 'autoprefixer', 'sass?sourceMap'], }, { test: /images\/.*\.(png|jpg|svg|gif)$/, loader: 'url-loader?limit=10000&name="[name]-[hash].[ext]"', }, { test: /fonts\/.*\.(woff|woff2|eot|ttf|svg)$/, loader: 'file-loader?name="[name]-[hash]

What does a `~` tilde in a CSS `url()` do?

我是研究僧i 提交于 2019-11-26 18:01:38
问题 E.g. @import url("~./foobar"); Saw it here, not sure if it's some package specific thing or if it's actual CSS syntax. 回答1: The CSS @import path <url> is usually relative to the current working directory. So using the prefix ~ at the start of the path tells the Webpack loader to resolve the import "like a module" from a node module path. What that means is that if you have a node module called normalize installed, and you need to import a file from within it named /normalize.css , you can do

Example of how to load static CSS files from node_modules using webpack?

不问归期 提交于 2019-11-26 14:35:47
问题 I don't know how to load with webpack any CSS from node_modules libs, for example I've installed leaflet and each attempt of load leaflet/dist/leaflet.css fails. Could you provide example how to load static styles from node_modules? My current webpack config below. Additionaly I'm using extract-text-webpack-plugin and sass-loader my project scss files are working well, I have also css-loader , have I to resolve static css files or add something to stylePathResolves ? //require('leaflet/dist

Webpack style-loader vs css-loader

放肆的年华 提交于 2019-11-26 11:46:40
问题 I have two questions. 1) CSS Loader and Style Loader are two webpack loaders. I couldn\'t grasp the difference between the two. Why do I have to use two loaders when they both do the same job? 2) What is this .useable.less and .useable.css mentioned in the above Readme.md files? 回答1: The CSS loader takes a CSS file and returns the CSS with imports and url(...) resolved via webpack's require functionality: var css = require("css!./file.css"); // => returns css code from file.css, resolves