Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ignore-styles

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ignore-styles - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

CHANGLELOG.md

5

ignore-styles.js

@@ -8,2 +8,7 @@ export const DEFAULT_EXTENSIONS = [

'.less',
'.gif',
'.jpeg',
'.jpg',
'.png',
'.svg',
]

@@ -10,0 +15,0 @@

2

lib/ignore-styles.js

@@ -7,3 +7,3 @@ 'use strict';

exports.default = register;
var DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = ['.css', '.scss', '.sass', '.stylus', '.styl', '.less'];
var DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = ['.css', '.scss', '.sass', '.stylus', '.styl', '.less', '.gif', '.jpeg', '.jpg', '.png', '.svg'];

@@ -10,0 +10,0 @@ var oldHandlers = exports.oldHandlers = {};

{
"name": "ignore-styles",
"version": "1.2.0",
"version": "2.0.0",
"description": "Ignore imported style files when running in Node",

@@ -5,0 +5,0 @@ "main": "lib/ignore-styles.js",

@@ -24,2 +24,6 @@ # ignore-styles

## Installation
$ npm install --save-dev ignore-styles
## More Examples

@@ -34,3 +38,3 @@

```js
import 'ignore-styles'
import 'ignore-styles'
```

@@ -65,5 +69,9 @@

import register from 'ignore-styles'
register(undefined, () => {styleName: 'fake_class_name'})
register(undefined, () => ({styleName: 'fake_class_name'}))
```
The first argument to `register` is the list of extensions to handle. Leaving it
undefined, as above, uses the default list. The handler function receives two arguments, `module` and `filename`, directly
from Node.
Why is this useful? One example is when using something like

@@ -74,2 +82,16 @@ [react-css-modules][react-css-modules]. You need the style imports to actually

Another use case would be to simply return the filename of an image so that it
can be verified in unit tests:
```js
register(undefined, (module, filename) => {
if (_.some(['.png', '.jpg'], ext => filename.endsWith(ext))) {
return path.basename(filename)
}
})
```
If the filename ends in '.png' or '.jpg', then the basename of the file is
returned as the value of the module on import.
## License

@@ -76,0 +98,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc