0

My app uses bootstrap css and local custom css. The problem is webpack's output included some local css before bootstrap css and some come after it, although all my app imported local css after bootstrap. Is there a way to put all custom css after bootstrap css?

[ webpack.config.js ]

config.module.loaders.push({
  ....
  { test: /\.css$/, loader: 'style!css' },
  {
    test: /\.lcss$/,
    loader: ExtractTextPlugin.extract(
      'style',
      'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
    ),
  }
);

[ component.js ]

import React from 'react';
import { Button, Col, Row } from 'react-bootstrap';
import _ from 'lodash';
import CSSModules from 'react-css-modules';
import styles from './HeroSection.lcss';

class Section extends React.Component {

  render() {
    return (
      <div className="section text-center">
        <Row>
          <Col xs={12} className={styles.caption}>
            Hello, Why !!
          </Col>
          <br />
          <br />
          <Button bsStyle="primary" href="#about">Learn more</Button>
        </Row>
        <img src="/assets/images/baseline.png" alt="baseline" />
      </div>
    );
  }
}
export default CSSModules(Section, styles);

[ section.lcss ]

.caption {
  font-size: 60px;
  color: #fff;
}
sglai
  • 307
  • 4
  • 10
  • From what I read, there is no defined order... it just get splurged out as and when. You could try doing `require('../../node_modules/bootstrap/dist/bootstrap.css'` ? – Callum Linington May 13 '16 at 07:46
  • You should use the ExtractPlugin for both css and lcss or for nothing. Just keep it consistent. – Tobias K. May 13 '16 at 08:02

0 Answers0