Installing crds-styles
is a two step process.
The first step involves installing crds-styles
and updating your application to consume the styles provided by it. The second step requires an update to your build process so that the physical assets (SVGs) included in crds-styles get copied into your dist/ directory during a build.
Execute the following command to update your application dependencies...
npm install crds-styles --save-dev
This will update the devDependencies
section of your package.json file with an entry for the crds-styles package and install the new require in your local node_modules
directory.
crds-styles
already includes the entire Bootstrap CSS library in it’s manifest, so there’s no need to add that package as a separate dependency.Next, import crds-styles
by adding the following line within your application’s SCSS manifest file...
@import 'crds-styles/assets/stylesheets/bootstrap';
To render the icons provided by crds-styles
, the precompiled SVGs must be publicly accessible to your users.
In order to make them available across environments, we recommend copying those assets from the node_modules/crds-styles/assets
directory during the build process so they can be served right alongside your application’s other bundled assets.
An example configuration for Webpack builds might look like this…
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
plugins: [
new CopyWebpackPlugin([
{
context: './node_modules/crds-styles/assets/svgs/',
from: '*.svg',
to: 'assets/svgs'
}
])
]
}
Restart your application and you’re done. You can now take advantage of all the styles, selectors and various patterns illustrated throughout the DDK and/or official Bootstrap documentation.