wdjungst / react-project

State of the art web development with React.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to add bootstrap

agalitsyn opened this issue · comments

Hi,

I'm trying to use create-react-project, because it contains some cool sctructure and features, but I have a problem - can't add bootstrap or materialize css. Project css includes like import '../modules/styles.css'. But bootstrap needs fonts and jquery, I can't just include them. What is recommended way to do this? I am a little bit confused by nested webpack structure, maybe you can help with little doc, or adding bootstrao in project?

Yeah, I'd like direct support for this too, for now you can hack your webpack.config.js

const Configs = require('react-project/webpack')

const LEGACY_CSS = /bootstrap|material/

Configs.ClientConfig.module.loaders.forEach((def) => {
  if (def.loader.match(/style-loader/)) {
    def.exclude = LEGACY_CSS
  }
})

Configs.ClientConfig.module.loaders.push({
  test: /LEGACY_CSS/,
  loader: 'style-loader!css-loader'
})

module.exports = Configs