Socket
Book a DemoInstallSign in
Socket

theme-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

theme-webpack-plugin

Resolve theme directory

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

About

This plugin allows you to use theme within any imported library that support it.

What is theme? Theme is just a directory inside module base directory that holds theme specific content (code, css, images, anything...)

Usage

Define module content

/my-cool-module
    /desktop
        index.js
    /mobile
        index.js
    index.js
    package.json

Add plugin to webpack resolver passing regex to match module name and theme name

const ThemeWebpackPlugin = require('theme-webpack-plugin');


resolver: {
    plugins: [
            new ThemeWebpackPlugin(/my-(cool|chill)-module/, 'desktop')
        ]
    };
}

Import module

import MyThemedClass from 'my-cool-module';

Now MyThemedClass is imported not from my-cool-module directory, but from my-cool-module/dekstop

Keywords

webpack

FAQs

Package last updated on 16 Jul 2018

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