Skip to content

Commit

Permalink
Allow styleLoaders to depends to env (#222)
Browse files Browse the repository at this point in the history
Allow styleLoaders to depend on env

```
"env": {
    "development": {
      "styleLoaders": ["style-loader", "css-loader", "resolve-url-loader", "sass-loader"],
      "extractStyles": false
    },
    "production": {
      "styleLoaders": ["style-loader", "css-loader", "sass-loader"],
      "extractStyles": true
    }
  }
```
* Update bootstrap.config.js
* Update package.json
* support styleLoaders env with userConfig
  • Loading branch information
bertho-zero authored and justin808 committed Dec 7, 2016
1 parent 6f254dc commit 09515c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. Items under

Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.

## [2.0.0.beta.17] - 2016-12-04
##### Added
- Allow `styleLoaders` to depend on the environment variable `NODE_ENV` [#222](https://github.com/shakacode/bootstrap-loader/pull/222) by [bertho-zero](https://github.com/bertho-zero).

## [2.0.0.beta.16] - 2016-11-23
##### Fixed
- Improved webpack performance. createUserImport should pass an absolute path to webpack.addDependency. [#212](https://github.com/shakacode/bootstrap-loader/pull/212) by [stephanwilliams](https://github.com/stephanwilliams).
Expand Down Expand Up @@ -75,7 +79,8 @@ Changes from v1.1.1 to 2.0.0.beta.2

## [1.0.8]

[Unreleased]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.16...master
[Unreleased]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.17...master
[2.0.0.beta.17]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.16...2.0.0-beta.17
[2.0.0.beta.16]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.15...2.0.0-beta.16
[2.0.0.beta.15]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.14...2.0.0-beta.15
[2.0.0.beta.14]: https://github.com/shakacode/bootstrap-loader/compare/2.0.0-beta.13...2.0.0-beta.14
Expand Down
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -225,6 +225,23 @@ styleLoaders:
- sass-loader?outputStyle=expanded
```

Different settings for different environments can be used.
```yaml
# It depends on value of NODE_ENV environment variable
env:
development:
styleLoaders:
- style-loader
- css-loader
- resolve-url-loader
- sass-loader
production:
styleLoaders:
- style-loader
- css-loader
- sass-loader
```

#### `extractStyles`

Default: `false`
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "bootstrap-loader",
"version": "2.0.0-beta.16",
"version": "2.0.0-beta.17",
"description": "Boostrap for Webpack",
"main": "loader.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap.config.js
Expand Up @@ -101,7 +101,7 @@ export default function createConfig({
appStyles: defaultConfig.appStyles,
useCustomIconFontPath: defaultConfig.useCustomIconFontPath,
extractStyles: extractStyles || getEnvProp('extractStyles', defaultConfig),
styleLoaders: defaultConfig.styleLoaders,
styleLoaders: getEnvProp('styleLoaders', defaultConfig),
styles: selectModules(defaultConfig.styles),
scripts: selectModules(defaultConfig.scripts),
configFilePath,
Expand Down Expand Up @@ -135,7 +135,7 @@ export default function createConfig({
useFlexbox: userConfig.useFlexbox,
useCustomIconFontPath: userConfig.useCustomIconFontPath,
extractStyles: extractStyles || getEnvProp('extractStyles', userConfig),
styleLoaders: userConfig.styleLoaders,
styleLoaders: getEnvProp('styleLoaders', userConfig),
styles: selectUserModules(userConfig.styles, defaultConfig.styles),
scripts: selectUserModules(userConfig.scripts, defaultConfig.scripts),
configFilePath,
Expand Down

0 comments on commit 09515c5

Please sign in to comment.