Changing the theme

To be precise, we're currently using the Bootstrap default theme; the first thing we can do is to change it with something slightly less common all over the world. There's a ton of free and commercial alternatives available; however, it will be wise to stick to the open source world, at least for now; luckily enough, there's a great open source Bootstrap theme collection available as an NPM package that we can easily use.

From Solution Explorer, open the package.json file and add the following highlighted one right below the reference to the bootstrap package:

[...]

"bootstrap": "3.3.7",
"bootswatch": "3.3.7",
"css": "2.2.1",

[...]

As soon as we click on Save, Visual Studio will download the package through NPM into the project's /node_modules/ folder.

To actually change the theme, we need to change the bootstrap.css file that will be fetched by Webpack and used to compile the distribution files. To do that, use the Solution Explorer to expand the tree node to the left of the webpack.config.js file to show the nested webpack.config.vendor.js file:

Open that nested file and change this single highlighted line:

const nonTreeShakableModules = [
'bootstrap',
'bootswatch/flatly/bootstrap.css',
'es6-promise',
'es6-shim',
'event-source-polyfill',
'jquery',
];
From that line, we can see how we're committing to the Bootswatch's Flatly theme; in case we don't like it, or if we want to try a different one before choosing, we can go to the Bootswatch project's official site and take a look at the other available themes at https://bootswatch.com/.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.231.194