https://github.com/lamo2k123/theme-webpack-plugin
https://github.com/lamo2k123/theme-webpack-plugin
es6 javascript js node-js nodejs theme webpack webpack-plugin webpack2 yarn
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/lamo2k123/theme-webpack-plugin
- Owner: lamo2k123
- Created: 2016-04-15T13:48:49.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-16T08:27:36.000Z (almost 8 years ago)
- Last Synced: 2025-05-28T12:07:50.256Z (about 1 year ago)
- Topics: es6, javascript, js, node-js, nodejs, theme, webpack, webpack-plugin, webpack2, yarn
- Language: JavaScript
- Size: 26.4 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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
```javascript
const ThemeWebpackPlugin = require('theme-webpack-plugin');
resolver: {
plugins: [
new ThemeWebpackPlugin(/my-(cool|chill)-module/, 'desktop')
]
};
}
```
Import module
```javascript
import MyThemedClass from 'my-cool-module';
```
Now MyThemedClass is imported not from my-cool-module directory, but from my-cool-module/dekstop