New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@researchgate/babel-plugin-transform-scss-import-to-string

Package Overview
Dependencies
Maintainers
11
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@researchgate/babel-plugin-transform-scss-import-to-string

Babel plugin for transforming SCSS imports to static variable declarations with transpiled CSS string

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-78.87%
Maintainers
11
Weekly downloads
 
Created
Source

babel-plugin-transform-scss-import-to-string

Build Status Codecov Greenkeeper badge NPM version

Babel transform plugin for replacing *.scss imports with static variable declaration as css string.

Example

import sideEffectStyles from './styles.sass';
// vvv
const sideEffectStyles = '.foo { color: red; }';

Quick start

Install the plugin first:

# yarn
yarn add --dev @researchgate/babel-plugin-transform-scss-import-to-string

# npm
npm install --save-dev @researchgate/babel-plugin-transform-scss-import-to-string

Add it to your babel configuration:

{
  "plugins": ["@researchgate/babel-plugin-transform-scss-import-to-string"]
}

Or with custom node-sass options:

{
  "plugins": [
    [
      "@researchgate/babel-plugin-transform-scss-import-to-string",
      { "precision": 3 }
    ]
  ]
}

Import *.scss files:

// foo.scss
$bar: 42px;
.foo {
  font-size: $bar;
}
// foo.js
import foo from './foo.scss';
console.log(foo); // -> .foo { font-size: 42px; }

Requirements

  • node-sass, which you should install explicitly
  • babel-core, which you should already have with babel configured

Caveats

  • This module shouldn't be used with webpack and sass-loader since babel transform would take first place in build process.
  • Every import transpiled with node-sass as an independent file, so you have to explicitly import dependencies if you used to have common context before.

Keywords

FAQs

Package last updated on 12 Nov 2019

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