From 217bdd276a7f2d8c97fbbb6a16e6dc7e117b4ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=BChnel?= Date: Fri, 15 Feb 2019 16:14:39 +0100 Subject: [PATCH] feat: Enable to define baumeister config in package.json (#270) You are now able to choose to store your settings either in a file called `baumeister.json` (respectively `.baumeister.json`) or in a `baumeister` key in your `package.json` file. Closes: #246 --- README.md | 18 ++++++++--------- build/config.js | 29 +++++++++++++++++++--------- build/handlebars.js | 6 +++++- build/webpack/config.entry.js | 8 ++++---- build/webpack/config.module.rules.js | 6 +++--- build/webpack/config.output.js | 8 ++++---- build/webpack/config.plugins.js | 25 +++++++++++++----------- package-lock.json | 29 +++++++--------------------- package.json | 1 + 9 files changed, 67 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 34de5c3..cd445f3 100644 --- a/README.md +++ b/README.md @@ -120,9 +120,9 @@ npm install npm will look at the `package.json` file and automatically fetch and install the necessary local dependencies needed for our build workflow as well as the required frontend dependencies to a `node_modules` directory. -### Adjust settings via the Baumeister config file +### Adjust settings via the Baumeister configuration file -In the root directory is a file named `baumeister.json` which can be used to change the most important settings without touching any webpack config: +You can change the most important settings without touching any webpack config by editing Baumeisters JSON based configuration. You are free to choose to store your settings either in a file called `baumeister.json` (respectively `.baumeister.json`) or in a `baumeister` key in your `package.json` file. ```json { @@ -177,7 +177,7 @@ If you want to provide constants for different types of builds, you can define t The plugin does a direct text replacement, so the value given to it must include actual quotes inside of the string. You can use alternating quotes, like `"'My value'"`, or use `JSON.stringify('My value')`. -This is very useful to change the behavior between development and production build. For example adapting the URL prefix to an API. This is why we have predefined the constant `PRODUCTION` in `baumeister.json`. +This is very useful to change the behavior between development and production build. For example adapting the URL prefix to an API. This is why we have predefined the constant `PRODUCTION` in [`baumeister.json`](#adjust-settings-via-the-baumeister-configuration-file). You may take a look at the official [webpack DefinePlugin docs](https://webpack.js.org/plugins/define-plugin/). @@ -238,7 +238,7 @@ Baumeister acts like a static site generator by default. Using handlebars we can Using Handlebars instead of plain HTML is fully optional and will probably suit your needs if you use Baumeister for creating a static site. If you are developing a single page application instead it would be a good idea to turn off handlebars compiling, place an `index.html` file in the `/src` directory, and store additional templates in `/src/app`. -In this case you have to switch off Handlebars compiling in `baumeister.json`: +In this case you have to switch off Handlebars compiling in [`baumeister.json`](#adjust-settings-via-the-baumeister-configuration-file): ```javascript /** @@ -553,7 +553,7 @@ myProject ### Bundling CSS from dependencies -If a used library ships its own CSS you have to include the paths to the files you like to bundle in the `vendor.bundleCSS` section of your `baumeister.json` to add the CSS to the `vendor.bundle.css` file. Please note that glob pattern matching is supported over here. +If a used library ships its own CSS you have to include the paths to the files you like to bundle in the `vendor.bundleCSS` section of your [`baumeister.json`](#adjust-settings-via-the-baumeister-configuration-file) to add the CSS to the `vendor.bundle.css` file. Please note that glob pattern matching is supported over here. ``` "vendor": { @@ -578,7 +578,7 @@ myProject ### Including static files from dependencies Sometimes you need to copy static files from an npm package to your project. This may be fonts or JavaScript files you need to include via separate `