style-loader
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -14,3 +14,3 @@ /* | ||
isOldIE = memoize(function() { | ||
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); | ||
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase()); | ||
}), | ||
@@ -17,0 +17,0 @@ getHeadElement = memoize(function () { |
@@ -0,0 +0,0 @@ /* |
@@ -10,3 +10,3 @@ /* | ||
if(this.cacheable) this.cacheable(); | ||
var query = loaderUtils.parseQuery(this.query); | ||
var query = loaderUtils.getOptions(this) || {}; | ||
return [ | ||
@@ -13,0 +13,0 @@ "// style-loader: Adds some css to the DOM by adding a <style> tag", |
{ | ||
"name": "style-loader", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -15,4 +15,4 @@ "description": "style loader module for webpack", | ||
"dependencies": { | ||
"loader-utils": "^0.2.7" | ||
"loader-utils": "^1.0.2" | ||
} | ||
} |
108
README.md
@@ -1,5 +0,24 @@ | ||
# style loader for webpack | ||
[![npm][npm]][npm-url] | ||
[![node][node]][node-url] | ||
[![deps][deps]][deps-url] | ||
[![chat][chat]][chat-url] | ||
## Usage | ||
<div align="center"> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
<h1>Style Loader</h1> | ||
</div> | ||
Adds CSS to the DOM by injecting a `<style>` tag | ||
<h2 align="center">Install</h2> | ||
``` | ||
npm install style-loader --save-dev | ||
``` | ||
<h2 align="center">Usage</h2> | ||
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) | ||
@@ -10,7 +29,7 @@ | ||
``` javascript | ||
require("style!raw!./file.css"); | ||
require("style-loader!raw-loader!./file.css"); | ||
// => add rules in file.css to document | ||
``` | ||
It's recommended to combine it with the [`css-loader`](https://github.com/webpack/css-loader): `require("style!css!./file.css")`. | ||
It's recommended to combine it with the [`css-loader`](https://github.com/webpack/css-loader): `require("style-loader!css-loader!./file.css")`. | ||
@@ -20,3 +39,3 @@ It's also possible to add a URL instead of a CSS string: | ||
``` javascript | ||
require("style/url!file!./file.css"); | ||
require("style-loader/url!file-loader!./file.css"); | ||
// => add a <link rel="stylesheet"> to file.css to document | ||
@@ -29,6 +48,6 @@ ``` | ||
When using [local scope CSS](https://github.com/webpack/css-loader#local-scope) the module exports the generated identifiers: | ||
When using [local scope CSS](https://github.com/webpack/css-loader#css-scope) the module exports the generated identifiers: | ||
``` javascript | ||
var style = require("style!css!./file.css"); | ||
var style = require("style-loader!css-loader!./file.css"); | ||
style.placeholder1 === "z849f98ca812bc0d099a43e0f90184" | ||
@@ -40,3 +59,3 @@ ``` | ||
``` javascript | ||
var style = require("style/useable!css!./file.css"); | ||
var style = require("style-loader/useable!css-loader!./file.css"); | ||
style.use(); // = style.ref(); | ||
@@ -60,3 +79,3 @@ style.unuse(); // = style.unref(); | ||
## Recommended configuration | ||
### Recommended configuration | ||
@@ -70,7 +89,24 @@ By convention the reference-counted API should be bound to `.useable.css` and the simple API to `.css` (similar to other file types, i.e. `.useable.less` and `.less`). | ||
module: { | ||
loaders: [ | ||
{ test: /\.css$/, exclude: /\.useable\.css$/, loader: "style!css" }, | ||
{ test: /\.useable\.css$/, loader: "style/useable!css" } | ||
] | ||
} | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
{ loader: "style-loader" }, | ||
{ loader: "css-loader" }, | ||
], | ||
}, | ||
{ | ||
test: /\.useable\.css$/, | ||
use: [ | ||
{ | ||
loader: "style-loader", | ||
options: { | ||
useable: true | ||
}, | ||
}, | ||
{ loader: "css-loader" }, | ||
], | ||
}, | ||
], | ||
}, | ||
} | ||
@@ -81,10 +117,42 @@ ``` | ||
## Install | ||
<h2 align="center">Contributing</h2> | ||
``` | ||
npm install style-loader | ||
``` | ||
Don't hesitate to create a pull request. Every contribution is appreciated. In development you can start the tests by calling `npm test`. | ||
## License | ||
<h2 align="center">Maintainers</h2> | ||
MIT (http://www.opensource.org/licenses/mit-license.php) | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/sokra?v=3"> | ||
<br /> | ||
<a href="https://github.com/">Tobias Koppers</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/SpaceK33z?v=3"> | ||
<br /> | ||
<a href="https://github.com/">Kees Kluskens</a> | ||
</td> | ||
<tr> | ||
<tbody> | ||
</table> | ||
<h2 align="center">LICENSE</h2> | ||
MIT | ||
[npm]: https://img.shields.io/npm/v/style-loader.svg | ||
[npm-url]: https://npmjs.com/package/style-loader | ||
[node]: https://img.shields.io/node/v/style-loader.svg | ||
[node-url]: https://nodejs.org | ||
[deps]: https://david-dm.org/webpack/style-loader.svg | ||
[deps-url]: https://david-dm.org/webpack/file-loader | ||
[chat]: https://badges.gitter.im/webpack/webpack.svg | ||
[chat-url]: https://gitter.im/webpack/webpack |
@@ -0,0 +0,0 @@ /* |
@@ -10,3 +10,3 @@ /* | ||
if(this.cacheable) this.cacheable(); | ||
var query = loaderUtils.parseQuery(this.query); | ||
var query = loaderUtils.getOptions(this) || {}; | ||
return [ | ||
@@ -13,0 +13,0 @@ "var refs = 0;", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19252
11
152
1
+ Addedbig.js@5.2.2(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedminimist@1.2.8(transitive)
- Removedbig.js@3.2.0(transitive)
- Removedemojis-list@2.1.0(transitive)
- Removedjson5@0.5.1(transitive)
- Removedloader-utils@0.2.17(transitive)
- Removedobject-assign@4.1.1(transitive)
Updatedloader-utils@^1.0.2