ignore-styles
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -5,2 +5,3 @@ export const DEFAULT_EXTENSIONS = [ | ||
'.sass', | ||
'.pcss', | ||
'.stylus', | ||
@@ -21,5 +22,5 @@ '.styl', | ||
export function noOp() {} | ||
export function noOp () {} | ||
export function restore() { | ||
export function restore () { | ||
for (const ext in oldHandlers) { | ||
@@ -36,3 +37,3 @@ if (oldHandlers[ext] === undefined) { | ||
export default function register(extensions = DEFAULT_EXTENSIONS, handler = noOp) { | ||
export default function register (extensions = DEFAULT_EXTENSIONS, handler = noOp) { | ||
restore() | ||
@@ -39,0 +40,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
exports.default = register; | ||
var DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = ['.css', '.scss', '.sass', '.stylus', '.styl', '.less', '.gif', '.jpeg', '.jpg', '.png', '.svg', '.mp4', '.webm', '.ogv']; | ||
var DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = ['.css', '.scss', '.sass', '.pcss', '.stylus', '.styl', '.less', '.gif', '.jpeg', '.jpg', '.png', '.svg', '.mp4', '.webm', '.ogv']; | ||
@@ -10,0 +10,0 @@ var oldHandlers = exports.oldHandlers = {}; |
{ | ||
"name": "ignore-styles", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Ignore imported style files when running in Node", | ||
"main": "lib/ignore-styles.js", | ||
"scripts": { | ||
"test": "mocha --require babel-register", | ||
"test": "standard ignore-styles.js && mocha --require babel-register", | ||
"build": "babel ignore-styles.js -s -o lib/ignore-styles.js", | ||
@@ -25,3 +25,2 @@ "watch": "babel ignore-styles.js -s -o lib/ignore-styles.js -w", | ||
"babel-cli": "^6.3.17", | ||
"babel-eslint": "^4.1.6", | ||
"babel-plugin-transform-object-assign": "^6.3.13", | ||
@@ -32,6 +31,5 @@ "babel-preset-es2015-loose": "^6.1.3", | ||
"chai": "^3.4.1", | ||
"eslint": "^1.10.3", | ||
"eslint-config-ecliptic": "^1.5.0", | ||
"mocha": "^2.3.3" | ||
"mocha": "^2.3.3", | ||
"standard": "^7.1.2" | ||
} | ||
} |
# ignore-styles | ||
[![Version][version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] | ||
[![Version][version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![Standard][standard-svg]][standard-url] | ||
@@ -24,2 +24,4 @@ A `babel/register` style hook to ignore style imports when running in Node. This | ||
**Note:** This is not for use *inside* Webpack. If you want to ignore extensions in Webpack you'll want to use a loader like [ignore-loader]. This is for use in Node outside of your normal Webpack build. | ||
## Installation | ||
@@ -108,3 +110,6 @@ | ||
[package-url]: https://npmjs.org/package/ignore-styles | ||
[standard-svg]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square | ||
[standard-url]: http://standardjs.com/ | ||
[default-extensions]: https://github.com/bkonkle/ignore-styles/blob/master/ignore-styles.js#L1 | ||
[react-css-modules]: https://github.com/gajus/react-css-modules | ||
[ignore-loader]: https://www.npmjs.com/package/ignore-loader |
@@ -1,6 +0,6 @@ | ||
import {expect} from 'chai' | ||
/* global describe, it, afterEach */ | ||
import { expect } from 'chai' | ||
import register, * as ignoreStyles from '../ignore-styles' | ||
describe('ignore-styles', () => { | ||
afterEach(() => { | ||
@@ -11,3 +11,2 @@ ignoreStyles.oldHandlers = {} | ||
describe('register()', () => { | ||
afterEach(() => { | ||
@@ -28,11 +27,9 @@ delete require.extensions['.blargh'] | ||
it('allows for a custom function to be provided instead of the no-op', () => { | ||
const customHandler = () => ({'soup': 'No soup for you!'}) | ||
const customHandler = () => ({soup: 'No soup for you!'}) | ||
register(['.blargh'], customHandler) | ||
expect(require.extensions['.blargh']).to.equal(customHandler) | ||
}) | ||
}) | ||
describe('restore', () => { | ||
afterEach(() => { | ||
@@ -43,3 +40,3 @@ delete require.extensions['.fake'] | ||
it('returns the handlers back to their previous state', () => { | ||
function fakeHandler() {} | ||
function fakeHandler () {} | ||
require.extensions['.fake'] = fakeHandler | ||
@@ -53,5 +50,3 @@ | ||
}) | ||
}) | ||
}) |
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
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
12310
8
116
114
13