Skip to content

Instantly share code, notes, and snippets.

View artem-malko's full-sized avatar
:shipit:
The truth is out there...

Artem Malko artem-malko

:shipit:
The truth is out there...
View GitHub Profile
@artem-malko
artem-malko / Webpack css-in-js loader
Last active November 18, 2019 09:57
css-in-js-loader.ts
import { loader } from 'webpack';
import { storeInstance } from '../store';
import { isValidStyleObject } from '../../generator/utils';
const loaderUtils = require('loader-utils');
// NodeJS Module
const Module = require('module');
// Replacement for loader.exec
// https://github.com/webpack/webpack.js.org/issues/1268#issuecomment-313513988
@artem-malko
artem-malko / css-in-js-plugin.ts
Last active November 18, 2019 04:52
Webpack css-in-js plugin
import { Plugin, Compiler } from 'webpack';
import { ConcatSource } from 'webpack-sources';
const loaderUtils = require('loader-utils');
const Chunk = require('webpack/lib/Chunk');
import { storeInstance } from '../store';
import { generateCss } from '../../generator';
import { StylesDescriptor } from '../../generator/utils';