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

extract-styles

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-styles

Extract-styles creates a theme package with lines from your SCSS files marked with // @theme

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Extract-styles

A node tool to generate a theme from SCSS files.

Extract-styles analyzes input SCSS files and extracts all definitions marked with a special 'theme' comment.

You can later load the resulting theme file, set the theme class on the body/root of the page to apply the new styles.

Before/after

Write your SCSS as you'd normally do, but mark the lines required in the theme file with @theme:

.foo {
  width: 100%;
  color: #ffff00; // @theme
  font-weight: bold;
  border: 1px solid #ff0000; // @theme
  
  &__content {
    padding: 10px;
    background-color: #eee; // @theme
  }
}

After running extract-styles, you'll get a theme file with the marked lines extracted:

.theme-default {
  .foo {
    color: #ffff00;
    border: 1px solid #ff0000;
  
    &__content {
      background-color: #eee;
    }
  }
}    

Install

$ npm install extract-styles --save-dev

Usage: CLI

Start the CLI and progress step-by-step with style extraction:

$ ./node_modules/.bin/extract-styles

Combine the following options to use with watchers (npm-watch or nodemon):

$ ./node_modules/.bin/extract-styles --root src --output src/themes/theme.scss --template t.tpl --mark @myTheme
--root      Define the root directory to start searching for SCSS files.
--output    The resulting SCSS theme file. Supply full path with filename and scss extension.
--template  Custom template for generating the theme file. Useful when you want to include imports.
--mark      Define a custom theme mark. It can be any string that will be unique for marking theme lines. (Default: @theme).

Contributing

PRs are much appreciated!

Use npm start while coding and npm test to run unit tests.

License

MIT © Marton Czebe

Keywords

FAQs

Package last updated on 21 Nov 2017

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