Skip to content

Commit 1dbdcdf

Browse files
author
Jannik Zschiesche
committed
Reluctantly support compiling CSS via webpack
1 parent 96b7e59 commit 1dbdcdf

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* (improvement) Build TypeScript for the `esnext` module system, that (amongst other things) allows to use `import()`.
3838
* (bug) Compile every entry into a separate directory, to avoid issues with the clean plugin.
3939
* (bc) Now only specific modules in `node_modules` are transformed. You need to set your packages explicity via `.compileNpmPackages()`.
40+
* (feature) Even if not recommended (use SCSS!), we now support compiling CSS via webpack (not as entry point though). The CSS will be injected into the head dynamically.
4041

4142

4243
8.1.0

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737
"eslint-plugin-react": "^7.17.0",
3838
"eslint-plugin-react-hooks": "^2.3.0",
3939
"fs-extra": "^8.1.0",
40-
"ignore-loader": "^0.1.2",
4140
"kaba-babel-preset": "^4.1.1",
4241
"kleur": "^3.0.3",
42+
"postcss-loader": "^3.0.0",
4343
"pretty-hrtime": "^1.0.3",
4444
"progress-bar-webpack-plugin": "^2.1.0",
4545
"raw-loader": "^4.0.0",
4646
"sade": "^1.7.0",
47+
"style-loader": "^1.1.3",
4748
"terser-webpack-plugin": "^2.3.2",
4849
"ts-loader": "^6.2.1",
4950
"typescript": "^3.7.4",

src/Kaba.ts

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
1313

1414
const PACKAGE_MATCHER = /\/node_modules\/(?<package>[^\/]+)\//;
1515
interface CompiledNpmPackagesMapping {[name: string]: true}
16+
interface PostCssLoaderOptions {[key: string]: any}
1617

1718
interface Entries
1819
{
@@ -75,6 +76,7 @@ export class Kaba
7576
mojave: true,
7677
'@mayd': true,
7778
};
79+
private postCssLoaderOptions: PostCssLoaderOptions = {};
7880

7981

8082
/**
@@ -252,6 +254,16 @@ export class Kaba
252254
}
253255

254256

257+
/**
258+
* Sets the loader options for the postcss loader
259+
*/
260+
public setPostCssLoaderOptions (options: PostCssLoaderOptions): this
261+
{
262+
this.postCssLoaderOptions = options;
263+
return this;
264+
}
265+
266+
255267
/**
256268
* Returns the kaba config
257269
*

0 commit comments

Comments
 (0)