gowravshekar / bootstrap-webpack

bootstrap package for webpack
MIT License
136 stars 22 forks source link

Include custom themes #34

Open pochemuto opened 7 years ago

pochemuto commented 7 years ago

How to include custom bootstrap theme? I downloaded theme from https://bootswatch.com. It contains two files: bootswatch.less and variables.less.

I had placed its in app folder and imported from bootstrap.config.less

@import "./theme/lumen/variables";
@import "./theme/lumen/bootswatch";

Theme changed but it looks broken. Maybe bootswatch.less overrides bootstrap styles and should be imported last ?

There is my configuration: https://github.com/pochemuto/mortgage

pochemuto commented 7 years ago

Issues was with redundant import bootstrap-webpack in js code: import "bootstrap-webpack";

pochemuto commented 7 years ago

So, yes. The problem is there. Import was redundant but removing them didn't help. The problem is related that ticket https://github.com/gowravshekar/bootstrap-webpack/issues/23

I found workaround: create somewhere in your app folder bootstrap.less file with following content:

@import "~bootstrap/less/mixins";
@import "theme/lumen/variables";
@import "theme/lumen/bootswatch";

bootswatch requires variables and last one might have bootstrap dependencies. In my case it was mixins.

Add file path to entry in webpack.config.js:

module.exports = {
    context: __dirname + "/app",
    entry: ['!!bootstrap-webpack!../bootstrap.config.js', './client/index.ts', './client/css/bootstrap.less'],
    output: ...

And then it will work.