Skip to content

Instantly share code, notes, and snippets.

@hpneo
Created August 15, 2017 04:42
Show Gist options
  • Save hpneo/410cf544f9ed10eb35d78ed5da311772 to your computer and use it in GitHub Desktop.
Save hpneo/410cf544f9ed10eb35d78ed5da311772 to your computer and use it in GitHub Desktop.
import styles from './styles.scss';
@import "~bulma/sass/utilities/all";
@import "src/config";
@import "~bulma/sass/grid/columns";
.summaryContainer {
@extend .columns;
padding: 2rem 0;
margin: 0;
}
const extractTextPluginOptions = shouldUseRelativeAssetPaths
? // Making sure that the publicPath goes back to to build folder.
{ publicPath: Array(cssFilename.split('/').length).join('../') }
: {};
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
Object.assign(
{
fallback: require.resolve('style-loader'),
use: [
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true,
minimize: true,
sourceMap: true,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
cssnano({
discardDuplicates: true,
discardUnused: true,
discardEmpty: true,
}),
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
],
},
extractTextPluginOptions
)
),
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
{
test: /\.(scss|sass)$/,
loader: ExtractTextPlugin.extract(
Object.assign(
{
fallback: require.resolve('style-loader'),
use: [
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true,
minimize: true,
sourceMap: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
{
loader: require.resolve('sass-loader'), // compiles Sass to CSS
},
],
},
extractTextPluginOptions
)
),
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment