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

Ignore imported style files when running in Node

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
114K
increased by2.61%
Maintainers
1
Weekly downloads
 
Created
Source

ignore-styles

Version Build Status License Downloads

A babel/register style hook to ignore style imports when running in Node. This is for projects that use something like Webpack to enable CSS imports in JavaScript. When you try to run the project in Node (to test in Mocha, for example) you'll see errors like this:

SyntaxError: /Users/brandon/code/my-project/src/components/my-component/style.sass: Unexpected token (1:0)
> 1 | .title
| ^
2 |   font-family: serif
3 |   font-size: 10em
4 |

To resolve this, use ignore-styles as a compiler:

mocha --compilers css:ignore-styles

This should work for more than just the "css" extension, because ignore-styles automatically registers itself for a number of extensions. See DEFAULT_EXTENSIONS for the full list, and send a pull request if you need more.

More Examples

To use this with multiple Mocha compilers:

mocha --compilers js:babel-register,css:ignore-styles

You can also use it just like babel/register:

    import 'ignore-styles'

In ES5:

    require('ignore-styles')

To customize the extensions used:

    import register from 'ignore-styles'
    register(['.sass', '.scss'])

To customize the extensions in ES5:

    require('ignore-styles')(['.sass', '.scss'])

Enjoy!

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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