anorudes / redux-easy-boilerplate

React redux easy boilerplate
MIT License
633 stars 123 forks source link

Skip intermediate index.js files for styles #20

Closed BinaryMuse closed 8 years ago

BinaryMuse commented 8 years ago

The style loader exports the value of .locals when it loads a file. Said another way, the intermediate index.js files that look like the following:

import 'style!./styles.scss';
export default require('./styles.scss').locals.styles;

could be written as

import locals from 'style!./styles.scss';
export default locals.styles;

This means that using the style loader alone can eliminate those index.js files altogether; this PR implements that, by adding the style loader to the list of loaders for SCSS files, and the styles are simply imported by the component file via

import { styles } from './styles/styles.scss';

This is implemented by b058baafc0f8bfc2f4cfed794c68a036b0ae3268

Additionally, ff97223a83bff30b1d66796f8483960e57526a5b allows index.scss to be resolved by default, simplifying the filenames when importing local styles. I made this a separate commit specifically since this functionality may not be wanted in this PR.

anorudes commented 8 years ago

nice work, @BinaryMuse :+1:

keske commented 8 years ago

Thanks!